python-fire icon indicating copy to clipboard operation
python-fire copied to clipboard

Feature Request: Add logging level support as a default parameter for functions

Open cheney-yan opened this issue 6 years ago • 1 comments

It would be nice to add a logging level option as a default option for all methods.

An ideal implementation would be like a decorator for a function: when a function is decorated, then the function will be added with [--log-level INFO] without specifying so.

For example, a method with a decorator:

@fire.logger(logger_object):
def a_method(params1):
     logger_object.debug('log line')

Will actually make a_method(param1) works like a_method(param1, log_level=logging.INFO).

cheney-yan avatar Sep 13 '18 11:09 cheney-yan

Love this idea — it doesn't seem like there's an easy way to do this!

j6k4m8 avatar Apr 07 '22 17:04 j6k4m8