Malcolm Greene wrote: > I have a class method that adds additional context to many of the > class's log messages. Rather than calling, for example, logger.info( > 'message ...' ) I would like to call my_object.log( 'message ...' ) so > that this additional context is managed in a single place. I'm actually > doing that and its working great except that ... as expected ... all my > log records have the my_object.log method's name and line numbers vs the > callers' names and line numbers. > Is there a technique I can use to have my custom log method inject the > caller's name and line numbers in the log output?
https://mail.python.org/pipermail/python-list/2010-March/570941.html No idea if this works with current Python, or if there is a more elegant way by now. -- https://mail.python.org/mailman/listinfo/python-list