From 795ca3945fcc3c0394ac9f691722ddf786b5ca53 Mon Sep 17 00:00:00 2001 From: Alexander Chekunkov Date: Thu, 21 May 2015 15:53:05 +0700 Subject: [PATCH] keep level_names in scrapy.log for backwards compatibility --- scrapy/log.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scrapy/log.py b/scrapy/log.py index e1c68aa93..719fceaad 100644 --- a/scrapy/log.py +++ b/scrapy/log.py @@ -1,7 +1,6 @@ """ This module is kept to provide a helpful warning about its removal. """ - import logging import warnings @@ -18,7 +17,7 @@ warnings.warn("Module `scrapy.log` has been deprecated, Scrapy now relies on " ScrapyDeprecationWarning, stacklevel=2) -# Imports kept for backwards-compatibility +# Imports and level_names variable kept for backwards-compatibility DEBUG = logging.DEBUG INFO = logging.INFO @@ -27,6 +26,15 @@ ERROR = logging.ERROR CRITICAL = logging.CRITICAL SILENT = CRITICAL + 1 +level_names = { + logging.DEBUG: "DEBUG", + logging.INFO: "INFO", + logging.WARNING: "WARNING", + logging.ERROR: "ERROR", + logging.CRITICAL: "CRITICAL", + SILENT: "SILENT", +} + def msg(message=None, _level=logging.INFO, **kw): warnings.warn('log.msg has been deprecated, create a python logger and '