Is there a way to configure logging
to automatically prefix the logged information with the current function name (=the function currently in execution when logger.info
is called)?
import logginglogging.basicConfig(level=logging.DEBUG)logger = logging.getLogger()class A: def foo(self): logger.info("hello") def bar(self): logger.info("world") a = A()a.foo() # should output: ... foo: helloa.bar() # should output: ... bar: world