If level is None, don't bother making the nullcontext.
This commit is contained in:
parent
c3c22270ee
commit
ba6cb79529
1 changed files with 2 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue