Let the wrapped mains take additional arguments.
Just in case the application wants to do so.
This commit is contained in:
parent
73e722fa7b
commit
38de31f1e2
2 changed files with 5 additions and 5 deletions
|
@ -239,14 +239,14 @@ def main_decorator(subject, *, log_return_value=True, **kwargs):
|
|||
3. Wrap main call with main_log_context.
|
||||
'''
|
||||
def wrapper(main):
|
||||
def wrapped(argv):
|
||||
def wrapped(argv, *args, **kwargs):
|
||||
(argv, level) = get_level_by_argv(argv)
|
||||
if level is None:
|
||||
return main(argv)
|
||||
return main(argv, *args, **kwargs)
|
||||
|
||||
context = main_log_context(subject, level, **kwargs)
|
||||
with context:
|
||||
status = main(argv)
|
||||
status = main(argv, *args, **kwargs)
|
||||
if log_return_value:
|
||||
log.info('Program finished, returned %s.', status)
|
||||
return status
|
||||
|
|
|
@ -182,8 +182,8 @@ def main_decorator(main):
|
|||
to use --debug, --quiet, etc. on the command line without making any
|
||||
changes to your argparser.
|
||||
'''
|
||||
def wrapped(argv):
|
||||
def wrapped(argv, *args, **kwargs):
|
||||
(level, argv) = get_level_by_argv(argv)
|
||||
add_root_handler(level)
|
||||
return main(argv)
|
||||
return main(argv, *args, **kwargs)
|
||||
return wrapped
|
||||
|
|
Loading…
Reference in a new issue