1
1
mirror of https://github.com/chubin/cheat.sh.git synced 2024-11-23 02:25:53 +03:00
cheat.sh/bin
Anatoli Babenia fec99a7a54 Properly setup Flask logging to stderr
Sometimes there is nothing, sometimes lines are duplicated.

Duplicated lines problem appears, because Python root logger
handler and Flask's `werkzeug` logger handler both write the
same message. `cheat.sh` is hit, because it sets this root
logging handler.

Normally `werkzeug` doesn't setup its own handler if it sees
that there are some handlers that process its messages. This
in case of `cheat.sh` resulted in no stderr logging at all.
No Exceptions either. Because `werkzeug` catches the
exceptions and logs them.

Hovewer, sometimes `werkzeug` starts too early, befora app
is imported (https://github.com/pallets/werkzeug/issues/1969)
and sets its logger anyway, before the app itself, resulting
in duplicating lines. In that case app root handler needs to
skip lines from `werkzeug`.

Kudos to @brandon-rhodes for `logging_tree` awesomeness
2020-11-17 13:38:16 +03:00
..
app.py Properly setup Flask logging to stderr 2020-11-17 13:38:16 +03:00
clean_cache.py Redis doesn't need to be Strict 2020-08-01 06:10:03 +03:00
release.py Implement cht.sh release script 2020-06-21 18:27:40 +02:00
srv.py Decouple Flask app from gevent monkeypatching 2020-11-16 12:02:12 +03:00