Logging: Formatter: name of the function

Gregor Horvath g.horvath at gmx.at
Fri Dec 23 10:23:57 EST 2005


Hi,

Is there a possibility to format a log message to give the function name 
where the log appears?

Example

import logging

def aTestFunction():
   logger.debug("This is a message")

The log should read:

aTestFunction  This is a message.

There is a possibilty to format the module namewith %(module)s, but I 
did not find one for the function name.

Is there a possibilty or can I create it myself?
How can I determine the function name within a function?
Introspection?

--
Greg



More information about the Python-list mailing list