Skip to content

Commit

Permalink
Adding a logging utility for improved logs
Browse files Browse the repository at this point in the history
  • Loading branch information
anupambhatnagar committed Mar 4, 2020
1 parent d98f40b commit 53779ec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ml-agents-envs/mlagents_envs/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import signal
import struct

logging.basicConfig(level=logging.INFO)

logger = logging.getLogger("mlagents_envs")


Expand Down
5 changes: 3 additions & 2 deletions ml-agents/mlagents/trainers/learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from mlagents_envs.side_channel.side_channel import SideChannel
from mlagents_envs.side_channel.engine_configuration_channel import EngineConfig
from mlagents_envs.exception import UnityEnvironmentException
from mlagents.logging_util import create_logger


def _create_parser():
Expand Down Expand Up @@ -450,8 +451,8 @@ def run_cli(options: RunOptions) -> None:
except Exception:
print("\n\n\tUnity Technologies\n")
print(get_version_string())
trainer_logger = logging.getLogger("mlagents.trainers")
env_logger = logging.getLogger("mlagents_envs")
trainer_logger = create_logger("mlagents.trainers")
env_logger = create_logger("mlagents_envs")

if options.debug:
trainer_logger.setLevel("DEBUG")
Expand Down
2 changes: 1 addition & 1 deletion ml-agents/mlagents/trainers/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def _write_summary(self, step: int) -> None:
)
if stats_summary.num > 0:
LOGGER.info(
" {}: {}: Step: {}. "
"{}: {}: Step: {}. "
"Time Elapsed: {:0.3f} s "
"Mean "
"Reward: {:0.3f}"
Expand Down

0 comments on commit 53779ec

Please sign in to comment.