Skip to content

Commit

Permalink
Patch missing isEnabledFor in LoggerAdapter
Browse files Browse the repository at this point in the history
This method is missing in Python <2.7, causing errors at runtime when
tasks try to call this method on their task loggers.
  • Loading branch information
gthb authored and ask committed Sep 24, 2012
1 parent 8fd3b4c commit ec2d99e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions celery/utils/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ def level(self):
from logging import LoggerAdapter
except ImportError:
LoggerAdapter = _CompatLoggerAdapter # noqa
else:
if not hasattr(LoggerAdapter, 'isEnabledFor'):
def isEnabledFor(self, level):
"""
See if the underlying logger is enabled for the specified level.
"""
return self.logger.isEnabledFor(level)
LoggerAdapter.isEnabledFor = isEnabledFor
del isEnabledFor


############## itertools.zip_longest #######################################

Expand Down

0 comments on commit ec2d99e

Please sign in to comment.