set log level before returning, if logger already has handlers.
This commit is contained in:
parent
9b1ccf82d9
commit
c410422c8a
1 changed files with 8 additions and 4 deletions
|
@ -62,8 +62,16 @@ class JsonFormatter(logging.Formatter):
|
|||
return exec_info[2].format_exc()
|
||||
|
||||
|
||||
def set_log_level(logger, args):
|
||||
level = logging.WARN
|
||||
if args.verbose:
|
||||
level = logging.DEBUG
|
||||
logger.setLevel(level)
|
||||
|
||||
|
||||
def setup_logging(args, version):
|
||||
logger = logging.getLogger()
|
||||
set_log_level(logger, args)
|
||||
if len(logger.handlers) > 0:
|
||||
return logger
|
||||
logfile = args.logfile
|
||||
|
@ -81,8 +89,4 @@ def setup_logging(args, version):
|
|||
)
|
||||
handler.setFormatter(formatter)
|
||||
logger.addHandler(handler)
|
||||
level = logging.WARN
|
||||
if args.verbose:
|
||||
level = logging.DEBUG
|
||||
logger.setLevel(level)
|
||||
return logger
|
||||
|
|
Loading…
Reference in a new issue