keep level_names in scrapy.log for backwards compatibility

This commit is contained in:
Alexander Chekunkov 2015-05-21 15:53:05 +07:00
parent ee59112480
commit 795ca3945f
1 changed files with 10 additions and 2 deletions

View File

@ -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 '