pysolver_view.reporting.logging module#
- pysolver_view.reporting.logging.create_logger(name, path=None, use_datetime=True, to_console=False)[source]#
Creates and configures a logging object for recording logs during program execution.
- Parameters:
- namestr
Name of the log file. Allows for differentiation when analyzing logs from different components or runs of a program.
- pathstr, optional
Specifies the directory where the log files will be saved. By default, a directory named “logs” will be created in the current working directory (cwd).
- use_datetimebool, optional
Determines whether the log filename should have a unique datetime identifier appended. Default is True.
- to_consolebool, optional
Whether to print log messages to the console. Default is True.
- Returns:
- loggerobject
Configured logger object.
Notes
By default, the function sets the log level to INFO, which means the logger will handle messages of level INFO and above (like ERROR, WARNING, etc.). The log entries will contain the timestamp, log level, and the actual log message.
When use_datetime=True, each log file will have a unique datetime identifier. This ensures traceability, avoids overwriting previous logs, allows chronological ordering of log files, and handles concurrency in multi-instance environments.