[Tutor] module.class.method in logging.debug

Brian Jones bkjones at gmail.com
Mon Mar 15 18:59:04 CET 2010


On Mon, Mar 15, 2010 at 1:26 PM, Brian Jones <bkjones at gmail.com> wrote:

> Hi all,
>
> I have some code that is a plugin for a larger app, and I'd like to be able
> to properly log issues that arise in the plugin code. I may not be
> maintaining this code forever, and I'd like the logging to work even if it's
> refactored later and code moved around, method names change, etc. So I'd
> like my logging to include a string identifying (programatically) the
> "module.class.method" where things went afoul.
>

Well, after some more reading, I found that I can get the module *and* the
method name if I add %(module)s and %(funcName) to my logging formatter. No
class though, and it's all or nothing: I really only want that behavior for
debug messages, not err/crit messages.

Any other thoughts?


-- 
Brian K. Jones
Python Magazine  http://www.pythonmagazine.com
My Blog          http://www.protocolostomy.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100315/ff0d78d2/attachment-0001.html>


More information about the Tutor mailing list