Browse Source

add log formatter in logfmt format

master
Edoardo Putti 7 years ago
parent
commit
e5de0fff70
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      server.py

+ 4
- 0
server.py View File

@ -10,11 +10,15 @@ from functools import wraps
app = Flask(__name__)
logfmt = 'time=%(asctime)s level=%(levelname)s app=%(name) msg=%(message)s'
logrotate = RotatingFileHandler(
'/var/log/login/server',
backupCount=10,
)
logrotate.setFormatter(logfmt)
logrotate.setLevel(logging.DEBUG)
app.logger.addHandler(logrotate)


Loading…
Cancel
Save