From ba6cb7952944f262fba3d58e0f7fc2d10a6b85c0 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 25 Oct 2021 12:28:22 -0700 Subject: [PATCH] If level is None, don't bother making the nullcontext. --- voussoirkit/operatornotify.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/voussoirkit/operatornotify.py b/voussoirkit/operatornotify.py index 65dd0ad..172a969 100644 --- a/voussoirkit/operatornotify.py +++ b/voussoirkit/operatornotify.py @@ -241,11 +241,10 @@ def main_decorator(subject, *, log_return_value=True, **kwargs): def wrapper(main): def wrapped(argv): (argv, level) = get_level_by_argv(argv) - context = main_log_context(subject, level, **kwargs) - - if isinstance(context, contextlib.nullcontext): + if level is None: return main(argv) + context = main_log_context(subject, level, **kwargs) with context: status = main(argv) if log_return_value: