fix: prevent logging config clobbering (#10133)
Previous behavior: loading this repository with `torch.hub.load` clobbers the existing logging configuration by modifying the root logger's configuration. New behavior: loading this repository with `torch.hub.load` only clobbers the logging configuration for logger `yolov5` and its descendants. Signed-off-by: Ryan Echols <ryan@shadylakemedia.com> Signed-off-by: Ryan Echols <ryan@shadylakemedia.com>pull/10166/head^2
parent
5e03f5fc8c
commit
166b9f2fa7
|
@ -126,8 +126,9 @@ def set_logging(name=None, verbose=VERBOSE):
|
|||
log.addHandler(handler)
|
||||
|
||||
|
||||
set_logging() # run before defining LOGGER
|
||||
LOGGER = logging.getLogger("yolov5") # define globally (used in train.py, val.py, detect.py, etc.)
|
||||
logger_name = "yolov5"
|
||||
set_logging(logger_name) # run before defining LOGGER
|
||||
LOGGER = logging.getLogger(logger_name) # define globally (used in train.py, val.py, detect.py, etc.)
|
||||
if platform.system() == 'Windows':
|
||||
for fn in LOGGER.info, LOGGER.warning:
|
||||
setattr(LOGGER, fn.__name__, lambda x: fn(emojis(x))) # emoji safe logging
|
||||
|
|
Loading…
Reference in New Issue