Enhance logging.

This commit is contained in:
Stephan Porada
2019-09-12 11:35:23 +02:00
parent 129ee05b51
commit 926935af56
3 changed files with 9 additions and 5 deletions

View File

@ -36,11 +36,17 @@ class DevelopmentConfig(Config):
os.environ.get('POSTGRES_PASSWORD'),
os.environ.get('POSTGRES_DB_NAME')
)
if not os.path.isfile('logs/opaque_web.log'):
file_path = os.path.join(os.getcwd(), 'logs/opaque_web.log')
log = open(file_path, 'w+')
log.close()
log_format = ("%(asctime)s - %(levelname)s - %(name)s - "
"%(filename)s - %(lineno)d - %(message)s")
logging.basicConfig(filename='logs/opaque_flask.log', level='WARNING',
logging.basicConfig(filename='logs/opaque_web.log', level='WARNING',
format=log_format, datefmt='%Y-%m-%d %H:%M:%S',
filemode='w')
logger = logging.getLogger(__name__)
logger.info('Logging has started.')
class TestingConfig(Config):