From e267dbbe1efaa67ad67cee0e48d419be3eb31666 Mon Sep 17 00:00:00 2001 From: Anupam Bhatnagar Date: Wed, 4 Mar 2020 14:26:00 -0800 Subject: [PATCH] add log level as an argument to create logger --- ml-agents/mlagents/logging_util.py | 3 +-- ml-agents/mlagents/trainers/learn.py | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ml-agents/mlagents/logging_util.py b/ml-agents/mlagents/logging_util.py index 07ab021776..6a1d2891d7 100644 --- a/ml-agents/mlagents/logging_util.py +++ b/ml-agents/mlagents/logging_util.py @@ -1,8 +1,7 @@ import logging -def create_logger(name): - log_level = logging.INFO +def create_logger(name, log_level=logging.INFO): date_format = "%Y-%m-%d %H:%M:%S" log_format = "%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] %(message)s" diff --git a/ml-agents/mlagents/trainers/learn.py b/ml-agents/mlagents/trainers/learn.py index 3ba6374c33..c65c537e36 100644 --- a/ml-agents/mlagents/trainers/learn.py +++ b/ml-agents/mlagents/trainers/learn.py @@ -451,16 +451,14 @@ def run_cli(options: RunOptions) -> None: except Exception: print("\n\n\tUnity Technologies\n") print(get_version_string()) - trainer_logger = create_logger("mlagents.trainers") - env_logger = create_logger("mlagents_envs") + trainer_logger = create_logger("mlagents.trainers", log_level=logging.INFO) + env_logger = create_logger("mlagents_envs", log_level=logging.INFO) if options.debug: trainer_logger.setLevel("DEBUG") env_logger.setLevel("DEBUG") else: - trainer_logger.setLevel("INFO") - env_logger.setLevel("INFO") - # disable noisy warnings from tensorflow. + # disable noisy warnings from tensorflow tf_utils.set_warnings_enabled(False) trainer_logger.debug("Configuration for this run:")