浏览代码

Fixing the GymWrapper Logging issue (#5201)

/check-for-ModelOverriders
GitHub 3 年前
当前提交
641c6e35
共有 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)
正在加载...
取消
保存