Use functools.wraps.

This commit is contained in:
voussoir 2021-10-30 17:29:01 -07:00
parent 38de31f1e2
commit f267d55f9d
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
2 changed files with 4 additions and 0 deletions

View file

@ -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:

View file

@ -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)