[Twisted-Python] Custom logging for twistd plugin

I'm looking to make some changes to the way a twistd plugin<http://twistedmatrix.com/projects/core/documentation/howto/plugin.html>logs information. The docs on logging<http://twistedmatrix.com/projects/core/documentation/howto/logging.html>and the application framework<http://twistedmatrix.com/projects/core/documentation/howto/application.html#auto6>don't currently mention how plugins fit in. My main goal is to have the log include information about the log level of each message represented as either text or an integer (like logging.DEBUG, etc). This would make log monitoring tools and alerts much more accurate as well as easier to write. I'd also like to be able to call log methods for each level (log.debug(), log.error(), etc) instead of only having log.msg(). For example, I'd prefer to turn: 2009-06-12 13:04:12-0700 [-] Foo service starting 2009-06-12 13:04:12-0700 [-] Loaded config from /etc/foo/missing.cfg 2009-06-12 13:04:12-0700 [-] Log file does not exist: /etc/foo/missing.cfg into something like: 20|2009-06-12 13:04:12|Foo service starting 10|2009-06-12 13:04:12|Loaded config from /etc/foo/missing.cfg 50|2009-06-12 13:04:12|Log file does not exist: /etc/foo/missing.cfg (10 = logging.DEBUG, 20 = logging.INFO, 50 = logging.CRITICAL from Python's logging module <http://docs.python.org/library/logging.html>) I've looked through most of the current logging code but I'm new to both Python and Twisted and am not sure if adding what I want through subclassing is the best approach or even a possibility. Thanks!
participants (1)
-
Garret Heaton