logger chain in python

Posted by Zaar Hai on Stack Overflow See other posts from Stack Overflow or by Zaar Hai
Published on 2010-06-07T12:24:51Z Indexed on 2010/06/07 12:42 UTC
Read the original article Hit count: 295

Filed under:
|

I'm writing python package/module and would like the logging messages mention what module/class/function they come from. I.e. if I run this code:

import mymodule.utils.worker as worker

w = worker.Worker()
w.run()

I'd like to logging messages looks like this:

2010-06-07 15:15:29 INFO mymodule.utils.worker.Worker.run <pid/threadid>: Hello from worker

How can I accomplish this?

Thanks.

© Stack Overflow or respective owner

Related posts about python

Related posts about logging