mirror of
https://github.com/craigerl/aprsd.git
synced 2025-04-19 09:49:01 -04:00
Allow passing in a custom handler to setup_logging
This adds the ability to pass in a custom log handler during startup in the log.setup_logging().
This commit is contained in:
parent
7ed8028307
commit
d262589313
@ -51,7 +51,7 @@ class InterceptHandler(logging.Handler):
|
||||
# Setup the log faciility
|
||||
# to disable log to stdout, but still log to file
|
||||
# use the --quiet option on the cmdln
|
||||
def setup_logging(loglevel=None, quiet=False):
|
||||
def setup_logging(loglevel=None, quiet=False, custom_handler=None):
|
||||
if not loglevel:
|
||||
log_level = CONF.logging.log_level
|
||||
else:
|
||||
@ -107,6 +107,9 @@ def setup_logging(loglevel=None, quiet=False):
|
||||
},
|
||||
)
|
||||
|
||||
if custom_handler:
|
||||
handlers.append(custom_handler)
|
||||
|
||||
# configure loguru
|
||||
logger.configure(handlers=handlers)
|
||||
logger.level('DEBUG', color='<fg #BABABA>')
|
||||
|
Loading…
Reference in New Issue
Block a user