Telemetry Logger

A guide on how to enable and use this feature can be found on the Environment Execution page.

class phantom.telemetry.TelemetryLogger[source]

This class is for logging episodes either to the terminal or to a JSON stream file.

An instance of this class is automatically initialised when the Phantom library is imported. It should be configured by the user using the configure_print_logging() and configure_file_logging() methods. Both print and file logging are turned off by default.

Warning

This feature will not produce desired results when using any form of multiprocessing / multiple workers! This feature is intended for debugging and testing purposes when using manual episode invocation.

Note

Any custom derived environments that modify the reset() and step() methods should take care to call the required class methods to enable telemetry logging.

configure_file_logging(file_path, append=True, human_readable=None, metrics=None)[source]

Configures logging to the a file in the JSON stream format (each episode is a JSON object separated by a newline).

Parameters:
  • file_path (Union[str, Path, None]) – The path to the file to save telemetry to.

  • append (bool) – If True will append to the file if it already exists, if False will overwrite any existing data.

  • human_readable (Optional[bool]) – If True will save the data in a human readable format.

  • metrics (Optional[Mapping[str, Metric]]) – Sets which metrics will be logged.

Return type:

None

configure_print_logging(enable=None, print_actions=None, print_observations=None, print_rewards=None, print_terminations=None, print_truncations=None, print_infos=None, print_messages=None, metrics=None)[source]

Configures logging to the terminal/stdout.

All options except metrics will log for:

  • All agents if True is given.

  • No agents if False is given.

  • A subset of agents if a list of :type:`AgentID`s is given.

  • The pre-existing choice if None is given.

Parameters:
Return type:

None