flask - Logging application use in python? -
i'd log every time uses flask app. i'd ideally have log looks this
timestamp 923829832 929299292 999993939
with list of unix time stamps represent each time user had accessed application. what's way this?
you use flask's after_request decorator.
for example:
import datetime import time @app.after_request def log(): open("app.log", "a") log: date = datetime.datetime.now() log.write(time.mktime(dt.timetuple()))
this open log file after each request, , log timestamp end of it.
Comments
Post a Comment