I think the following question is clearer. I want to make it so that method1 below can be transformed:
logger = logging.getLogger("somelogger") class SomeOp: def __init__(self, ctx): self.ctx = ctx def method1(self): logger.info("%s: here's a message", self.ctx) logger.debug("%s: msg #2", self.ctx) v = 'yessir' logger.debug("%s: msg #3 %s", self.ctx, v) into something like: def method1(self): logger.info("here's a message") logger.debug("msg #2") v = 'yessir' logger.debug("msg #3 %s", v) What is the best way to do this, so that I don't have to manually put the self.ctx in the log string in hundreds of different places? Thanks, Gary -- http://mail.python.org/mailman/listinfo/python-list