1
0
mirror of https://github.com/chubin/cheat.sh.git synced 2026-06-20 21:26:44 +02:00
Commit Graph

2 Commits

Author SHA1 Message Date
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
Anatoli Babenia 277b45e83c Decouple Flask app from gevent monkeypatching 2020-11-16 12:02:12 +03:00