From af956b48cf330ab770c85d496431389c6b92ac06 Mon Sep 17 00:00:00 2001 From: Gusev Anton <gusev_aa@groupbwt.com> Date: Thu, 13 Jun 2019 18:42:11 +0300 Subject: [PATCH] change logging settings --- .gitignore | 1 + src/settings.py | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 888cebc..ae4fd72 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ alembic.ini __pycache__ *.json src/spiders/test_spider.py +*.log \ No newline at end of file diff --git a/src/settings.py b/src/settings.py index cd2081a..d96ddc1 100644 --- a/src/settings.py +++ b/src/settings.py @@ -105,19 +105,16 @@ CONNECTION_STRING = "{drivername}://{user}:{passwd}@{host}:{port}/{db_name}?char db_name=os.getenv('DB_DATABASE'), ) - # Logger config -LOG_FILE = '../log/all.log' -LOG_ENABLED = True -LOG_LEVEL = logging.DEBUG -LOG_FORMAT = '%(asctime)s - %(levelname)s - %(name)s : \n\t %(message)s' -# LOG_DATEFORMAT -LOG_STDOUT = False +LOG_FILE = os.getenv('LOG_FILE', 'log.log') +LOG_ENABLED = os.getenv('LOG_ENABLED', True) +LOG_LEVEL = logging._nameToLevel[os.getenv('LOG_LEVEL', 'INFO')] +LOG_FORMAT = os.getenv('LOG_FORMAT', '%(asctime)s - %(levelname)s - %(name)s : \n %(message)s') +# LOG_DATEFORMAT # TODO +LOG_STDOUT = os.getenv('LOG_STDOUT', False) LOG_SHORT_NAMES = False - # Mail config -# TODO to .env file MAIL_FROM = os.getenv('MAIL_FROM', 'scrapy@localhost') MAIL_HOST = 'smtp.gmail.com' MAIL_PORT = 465 -- GitLab