Another source of time for the logging package?

Skip Montanaro skip at pobox.com
Wed Jun 1 09:48:58 EDT 2005


    >> Before I get out my scalpel, has anyone found a non-invasive way to
    >> do this (or already done the surgery and would be willing to share
    >> it)?

    Ames> While I'm not sure you would call the following 'non-invasive'
    Ames> I've used it in a similar situation:

    Ames> class MyLogRecord(logging.LogRecord):
    Ames>     def __init__(*args, **kwargs):
    Ames>         logging.LogRecord.__init__(self, *args, **kwargs)
    Ames>         self.created = time_warp() # get the time you need
    ...

Excellent!  Works like a charm.  Thanks,

Skip



More information about the Python-list mailing list