logging.NullHandler now available in Python 2.7

This commit is contained in:
Ask Solem 2016-01-05 15:27:32 -08:00
parent 237be6066d
commit 70d4c34a00
1 changed files with 1 additions and 7 deletions

View File

@ -24,17 +24,11 @@ LOG_LEVELS.setdefault(logging.FATAL, 'FATAL')
DISABLE_TRACEBACKS = os.environ.get('DISABLE_TRACEBACKS')
class NullHandler(logging.Handler):
def emit(self, record):
pass
def get_logger(logger):
if isinstance(logger, string_t):
logger = logging.getLogger(logger)
if not logger.handlers:
logger.addHandler(NullHandler())
logger.addHandler(logging.NullHandler())
return logger