How to prepend anything to a logging message? Is possible to do it
from the dictionary object (ExtraLog) or is there is that override
process() [1]?

------------------
class ExtraLog(object):

    def __getitem__(self, name):
        if name == 'foo':
            result = 'testing'
        return result

    def __iter__(self):
        keys = ['foo',]
        keys.extend(self.__dict__.keys())
        return iter(keys)

logger = logging.LoggerAdapter(logging.getLogger('foo'), ExtraLog())
------------------


[1] http://docs.python.org/library/logging.html#logging.LoggerAdapter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to