Skip to content

Commit

Permalink
Fix windows LOGGER with emojis output (#8958)
Browse files Browse the repository at this point in the history
* Fix duplicate LOGGER output

* Update general.py
  • Loading branch information
glenn-jocher committed Aug 13, 2022
1 parent dc38cd0 commit 7639e4c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ def set_logging(name=None, verbose=VERBOSE):

set_logging() # run before defining LOGGER
LOGGER = logging.getLogger("yolov5") # define globally (used in train.py, val.py, detect.py, etc.)
for fn in LOGGER.info, LOGGER.warning:
_fn, fn = fn, lambda x: _fn(emojis(x)) # emoji safe logging
if platform.system() == 'Windows':
for fn in LOGGER.info, LOGGER.warning:
setattr(LOGGER, fn.__name__, lambda x: fn(emojis(x))) # emoji safe logging


def user_config_dir(dir='Ultralytics', env_var='YOLOV5_CONFIG_DIR'):
Expand Down

0 comments on commit 7639e4c

Please sign in to comment.