Closed jiangpan closed 3 years ago
Hi - it's been a while since I used Flask; I'll look into it and get back to you.
This is a starting point for configuring Flask logging but I'll see if I can write up some example YAML for it:
http://flask.pocoo.org/docs/1.0/logging/
(work's pretty crazy today so I probably won't get to this until tomorrow, though)
You first set up your logging:
seqlog.configure_from_file(filename)
And then you can use my excellent library called flask-requests-logging to log Flask to it:
app = flask.Flask(__name__)
FlaskRequestsLogging(app, pass_as_extras=False)
pass_as_extras
is extra helpful, as it helps to deal with these kinds of statements, which are frequently used if you're using seqlog
:
logger.log('Testing logging %s', 2, device_id='2')
vs the more Pythonic
logger.log('Testing logging %s', 2, extras={'device_id': '2'})
or extra
I don't really remember now.
Works like a charm for me. Closing this issue.
Description
Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.
What I Did