Phuks-co / throat

Open Source link aggregator and discussion platform powering Phuks
https://phuks.co
MIT License
73 stars 32 forks source link

Make g available to logging formatters #153

Closed happy-river closed 4 years ago

happy-river commented 4 years ago

Allow logging format strings to use the application globals stored in g. This creates a way to identify the logging records associated with a single request, by including g.start in the log record.

Also, current_user is a proxy which will try to load the current user if it hasn't yet been loaded, which is not something that logging code should be doing, so make a check and only access current_user if it has already been loaded.