irsim.env.env_logger#
Classes#
Thin wrapper around Loguru used by IR-SIM environments. |
Module Contents#
- class irsim.env.env_logger.EnvLogger(log_file: str | None = 'irsim_error.log', log_level: str = 'WARNING')[源代码]#
Thin wrapper around Loguru used by IR-SIM environments.
Each environment owns a console sink at its
log_leveland, whenlog_fileis given, a file sink. Its messages are tagged and its sinks accept only that tag, so a second environment in the same process neither replaces the first one's sinks nor receives its messages. Sinks added by user code are left alone.closeremoves the sinks; garbage collection does the same.Initialize the EnvLogger.
- 参数:
log_file (str, optional) -- Path to the log file. Default is 'irsim_error.log'.
log_level (str, optional) -- Logging level. Default is 'WARNING'.
- CONSOLE_FORMAT = '<green>{time:YYYY-MM-DD HH:mm}</green> | <level>{level: <8}</level> | <level>{message}</level>'#
- warning_once(msg: str, key: str | None = None) None[源代码]#
Log a warning the first time
key(default:msg) is seen, then at DEBUG.For per-step conditions that would otherwise flood the log every step.
- 参数:
msg (str) -- The message to log.
key (str, optional) -- Identity of the condition when
msgvaries.