From fa78fa3b9d5ec1e87cc49e1c0514a36b7713ab23 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 30 Apr 2022 07:22:18 -0700 Subject: [PATCH] Add global ARGV_LEVEL for runtime use. --- voussoirkit/vlogging.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/voussoirkit/vlogging.py b/voussoirkit/vlogging.py index 9ced9f9..e46bdb5 100644 --- a/voussoirkit/vlogging.py +++ b/voussoirkit/vlogging.py @@ -38,6 +38,7 @@ root.setLevel(NOTSET) LOUD = 1 SILENT = 99999999999 +ARGV_LEVEL = NOTSET _did_earlybird = False def add_loud(log): @@ -208,12 +209,14 @@ def main_decorator(main): betterhelp.HELPTEXT_EPILOGUES.add(BETTERHELP_EPILOGUE) @functools.wraps(main) def wrapped(argv, *args, **kwargs): + global ARGV_LEVEL # The reason we don't call basic_config is that another module may have # attached a root handler for another purpose. # However we do check _did_earlybird so that we don't get double # handlers from this module. if not _did_earlybird: (level, argv) = get_level_by_argv(argv) + ARGV_LEVEL = level add_root_handler(level) return main(argv, *args, **kwargs) return wrapped