@hynek I know you have some snippets about using #structlog with #Flask on the docs, bu do you know of a sample repo with something like "this is a sample Flask app with everything set up to show basic request information on stdout and/or a log file using structlog"? Extra points if it has configuration for #gunicorn.
#structlog #flask #gunicorn #logging #Python
@xahteiwi I think old style logging formatting is preferred as an optimisation. If you use f-string then the string is evaluated before the call but depending on the log config it might not be used (i.e. debug logging disabled). Whereas if you use the old style then it is never evaluated if it is thrown away
… but better still, use #structlog 😀
an article about #structlog, a library enabling to write logs as #json documents in your #Python applications. I prefer the way to use it (you import the logger factory from structlog), in comparison of #python_json_logger, where you import the library (doing so decorates the native Python logging module) AND the native logging module, from which you retrieve the loggers. The latter approach can break when use formatting tools like isort, which sort the imports.
#python_json_logger #Python #json #structlog
As promised, #structlog 22.3.0 is out with two bug fixes relating native loggers and string interpolation:
https://github.com/hynek/structlog/releases/tag/22.3.0 #python #logging
RT @hynek
I’ve just been approved to GitHub Sponsors! I have procrastinated on it b/c I was afraid it might get embarrassing...prove me wrong if my software (or whatever else I’ve done) helped you make money? 😇 #python #attrs #structlog
🔖 Logging Rethought: The Current State Of Logging (Markus Holtermann) https://markusholtermann.eu/2019/04/logging-rethought/
#python #logging #structlog #django #security
#Python #logging #structlog #Django #security