Add vlogging.main_decorator to reduce application boilerplate.

This commit is contained in:
voussoir 2021-06-21 21:54:42 -07:00
parent 9cd7713a6b
commit 81d09ad3bc
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -105,6 +105,12 @@ def get_level_by_name(name):
return value
def main_decorator(main):
def wrapped(argv):
argv = main_level_by_argv(argv)
return main(argv)
return wrapped
def main_level_by_argv(argv):
'''
This function puts a handler on the root logger with a level set by the