yes, I stared at that section for a bit. Not to get off topic, but the
opinion. So the topic being I'm an idiot - thanks for both
examples...that's a perfect example.
wondering if myobservers is a core package.
Post by Kevin Mcintyrehttp://twistedmatrix.com/documents/current/core/howto/logger.html
I'm looking at the new-ish logger api and wonder how to log to console as
a first step to transitioning.
Any pointers? Thanks.
Do you mean "emit structured log text to stdout"? In that case, that is
http://twistedmatrix.com/documents/current/core/howto/logger.html#avoid-mutable-event-keys
http://twistedmatrix.com/documents/current/core/howto/logger.html#starting-the-global-log-publisher
import sys
from twisted.logger import jsonFileLogObserver, globalLogBeginner, Logger
globalLogBeginner.beginLoggingTo([jsonFileLogObserver(sys.stdout)])
log = Logger()
log.info("Information.")
If you want unstructured log output for human reading (not a good choice
for an automated system, but perhaps useful for debugging), you can instead
import sys
from twisted.logger import textFileLogObserver, globalLogBeginner, Logger
globalLogBeginner.beginLoggingTo([textFileLogObserver(sys.stdout)])
log = Logger()
log.info("Information.")
Is this what you were looking for?
-glyph
_______________________________________________
Twisted-Python mailing list
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python