Message201783
Put the following into a file named "repro.py", then type "python repro.py" at your shell. You'll see ``AttributeError: 'CustomAdapter' object has no attribute 'setLevel'``
import logging logging.basicConfig ()
class CustomAdapter(logging.LoggerAdapter):
def process(self, msg, kwargs):
return '[%s] %s' % (self.extra['connid'], msg), kwargs
logger = logging.getLogger(__name__)
adapter = CustomAdapter(logger, {'connid': '1234'})
adapter.setLevel (logging.WARN)
adapter.warning ("Ahoy matey") |
|
Date |
User |
Action |
Args |
2013-10-30 23:01:38 | Eric.Hanchrow | set | recipients:
+ Eric.Hanchrow |
2013-10-30 23:01:38 | Eric.Hanchrow | set | messageid: <1383174098.42.0.658562417274.issue19455@psf.upfronthosting.co.za> |
2013-10-30 23:01:38 | Eric.Hanchrow | link | issue19455 messages |
2013-10-30 23:01:38 | Eric.Hanchrow | create | |
|