from u2fval import app
import logging
from logging.handlers import RotatingFileHandler
# First we remove the default logging handlers.
for handler in app.logger.handlers:
app.logger.removeHandler(handler)
# Now we add our own.
handler = RotatingFileHandler('/var/log/u2fval.log', maxBytes=100000, backupCount=1)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('[%(levelname)s] %(asctime)s %(name)s: %(message)s', '%Y-%m-%d %I:%M:%S')
handler.setFormatter(formatter)
app.logger.addHandler(handler)
application = app