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

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -