def app_logger(app):
"""
Set up logger for the app.
:param app: The Flask app
:return: None
"""
format_string = (
'=================================================================\n'
'[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s\n'
'=================================================================\n'
)
formatter = logging.Formatter(format_string)
handler = RotatingFileHandler(filename='logs/app.log', maxBytes=10000000,
backupCount=1)
handler.setLevel(app.config['LOG_LEVEL'])
handler.setFormatter(formatter)
app.logger.addHandler(handler)
return
评论列表
文章目录