academy.logging¶
init_logging
¶
init_logging(
level: int | str = INFO,
*,
logfile: str | Path | None = None,
logfile_level: int | str | None = None,
color: bool = True,
extra: bool = False,
force: bool = False
) -> Logger
Initialize global logger.
Parameters:
-
level
(int | str
, default:INFO
) –Minimum logging level.
-
logfile
(str | Path | None
, default:None
) –Configure a file handler for this path.
-
logfile_level
(int | str | None
, default:None
) –Minimum logging level for the file handler. Defaults to that of
level
. -
color
(bool
, default:True
) –Use colorful logging for stdout.
-
extra
(bool
, default:False
) –Include extra info in log messages, such as thread ID and process ID. This is helpful for debugging.
-
force
(bool
, default:False
) –Remove any existing handlers attached to the root handler. This option is useful to silencing the third-party package logging. Note: should not be set when running inside pytest.
Returns:
-
Logger
–The root logger.