Skip to content

Commit

Permalink
add log level as an argument to create logger
Browse files Browse the repository at this point in the history
  • Loading branch information
anupambhatnagar committed Mar 4, 2020
1 parent 6fa4190 commit e267dbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions ml-agents/mlagents/logging_util.py
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
8 changes: 3 additions & 5 deletions ml-agents/mlagents/trainers/learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:")
Expand Down

0 comments on commit e267dbb

Please sign in to comment.