浏览代码

Fixing the GymWrapper Logging issue (#5201)

(cherry picked from commit 8457c5bf87dcd943eb200a68735d48f84864448c)
/release_16_branch
Ervin Teng 4 年前
当前提交
9e110528
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 12
      ml-agents-envs/mlagents_envs/logging_util.py

12
ml-agents-envs/mlagents_envs/logging_util.py


import logging # noqa I251
import sys
CRITICAL = logging.CRITICAL
FATAL = logging.FATAL

specified by set_log_level()
"""
logger = logging.getLogger(name=name)
handler = logging.StreamHandler(stream=sys.stdout)
formatter = logging.Formatter(fmt=LOG_FORMAT, datefmt=DATE_FORMAT)
handler.setFormatter(formatter)
logger.addHandler(handler)
# Keep track of this logger so that we can change the log level later
_loggers.add(logger)

"""
global _log_level
_log_level = log_level
# Configure the log format.
# In theory, this would be sufficient, but if another library calls logging.basicConfig
# first, it doesn't have any effect.
logging.basicConfig(level=_log_level, format=LOG_FORMAT, datefmt=DATE_FORMAT)
for logger in _loggers:
logger.setLevel(log_level)
正在加载...
取消
保存