diff --git a/.gitignore b/.gitignore index 888cebc99206062a22a7b7605ac79129a38836ab..ae4fd720e9f43fe2d0cf9e883f33e3060f75f787 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 cd2081ac0cc070c3e545f916eae9f7e468c7778f..d96ddc1a3c84d848d9b4e7e98b60785c784f44a6 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