From c87fc584daa32e6725f6f5ee0abd0a9d7a965200 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 9 Oct 2021 17:48:35 -0700 Subject: [PATCH] Call vlogging.basic_config as part of main_decorator. --- voussoirkit/operatornotify.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/voussoirkit/operatornotify.py b/voussoirkit/operatornotify.py index f737fb7..085ba94 100644 --- a/voussoirkit/operatornotify.py +++ b/voussoirkit/operatornotify.py @@ -243,6 +243,13 @@ def main_decorator(subject, *args, **kwargs): (argv, level) = get_level_by_argv(argv) context = main_log_context(subject, level, *args, **kwargs) + # We need to call basic_config so that operatornotify's logs have + # somewhere to go. We do this only during wrapped, not before, so + # that if the main also has vlogging.main_decorator or any other + # decorators that will prepare the logging before main is called, + # this shouldn't interfere with those. + vlogging.basic_config(vlogging.INFO) + if isinstance(context, contextlib.nullcontext): return main(argv)