Use functools.wraps.
This commit is contained in:
parent
38de31f1e2
commit
f267d55f9d
2 changed files with 4 additions and 0 deletions
|
@ -49,6 +49,7 @@ Examples:
|
|||
'''
|
||||
import argparse
|
||||
import contextlib
|
||||
import functools
|
||||
import io
|
||||
import sys
|
||||
import traceback
|
||||
|
@ -239,6 +240,7 @@ def main_decorator(subject, *, log_return_value=True, **kwargs):
|
|||
3. Wrap main call with main_log_context.
|
||||
'''
|
||||
def wrapper(main):
|
||||
@functools.wraps(main)
|
||||
def wrapped(argv, *args, **kwargs):
|
||||
(argv, level) = get_level_by_argv(argv)
|
||||
if level is None:
|
||||
|
|
|
@ -8,6 +8,7 @@ and SILENT, and all loggers from getLogger are given the `loud` method.
|
|||
|
||||
Don't forget to like, comment, and subscribe.
|
||||
'''
|
||||
import functools
|
||||
from logging import *
|
||||
import sys
|
||||
|
||||
|
@ -182,6 +183,7 @@ def main_decorator(main):
|
|||
to use --debug, --quiet, etc. on the command line without making any
|
||||
changes to your argparser.
|
||||
'''
|
||||
@functools.wraps(main)
|
||||
def wrapped(argv, *args, **kwargs):
|
||||
(level, argv) = get_level_by_argv(argv)
|
||||
add_root_handler(level)
|
||||
|
|
Loading…
Reference in a new issue