duo_ai.utils.logging¶
Classes¶
Formatter for logging that prepends elapsed time since initialization. |
Functions¶
|
Configure logging to output to both a file and the console with elapsed time formatting. |
Module Contents¶
- duo_ai.utils.logging.configure_logging(log_file)[source]¶
Configure logging to output to both a file and the console with elapsed time formatting.
Sets up logging handlers and a custom exception hook for uncaught exceptions.
- Parameters:
log_file (str) – Path to the log file where logs will be written.
- Return type:
None
Examples
>>> configure_logging('experiment.log')
- class duo_ai.utils.logging.ElapsedFormatter[source]¶
Formatter for logging that prepends elapsed time since initialization.
- Parameters:
None –
- start_time¶
The time when the formatter was initialized.
- Type:
datetime.datetime
Examples
>>> formatter = ElapsedFormatter() >>> formatter.format_time(datetime.now() - formatter.start_time) '0:00:01'
- start_time¶