mirror of https://github.com/celery/kombu.git
logging.NullHandler now available in Python 2.7
This commit is contained in:
parent
237be6066d
commit
70d4c34a00
|
@ -24,17 +24,11 @@ LOG_LEVELS.setdefault(logging.FATAL, 'FATAL')
|
||||||
DISABLE_TRACEBACKS = os.environ.get('DISABLE_TRACEBACKS')
|
DISABLE_TRACEBACKS = os.environ.get('DISABLE_TRACEBACKS')
|
||||||
|
|
||||||
|
|
||||||
class NullHandler(logging.Handler):
|
|
||||||
|
|
||||||
def emit(self, record):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def get_logger(logger):
|
def get_logger(logger):
|
||||||
if isinstance(logger, string_t):
|
if isinstance(logger, string_t):
|
||||||
logger = logging.getLogger(logger)
|
logger = logging.getLogger(logger)
|
||||||
if not logger.handlers:
|
if not logger.handlers:
|
||||||
logger.addHandler(NullHandler())
|
logger.addHandler(logging.NullHandler())
|
||||||
return logger
|
return logger
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue