Logging¶
logging
¶
Custom logging, based on Python's built-in logger.
Info
Logging can only be used for non-jitted solver loops, it is thus only recommended for eploratory runs on small test problems
Classes:
Name | Description |
---|---|
LoggerSettings |
Data class for logger settings |
LogValue |
Data class for log values |
Logger |
Custom logger class |
eikonax.logging.LoggerSettings
dataclass
¶
Logger Settings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
log_to_console
|
bool
|
If True, log messages will be printed to the console. |
required |
logfile_path
|
Path
|
Path to the logfile. If None, no logfile will be generated |
required |
eikonax.logging.LogValue
dataclass
¶
Data class holding info to log.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
str_id
|
str
|
String identifier to be shown at the top of the log table |
required |
str_format
|
str
|
String format for the log value in log file and on consoles |
required |
value
|
Real
|
Actual value to log |
None
|
eikonax.logging.Logger
¶
Custom logger class.
This class is a minimal wrapper around the Python logger class. It provides handles for logging
to the console or a file, depending on the user settings. The class's main interface is the
log
method, which takes a list of
LogValue
objects and logs them with the given values and string
formats.
Methods:
Name | Description |
---|---|
log |
Log the values in the log_values list |
header |
Log the header of the log table |
info |
Log a message to the console and/or logfile |
__init__
¶
Constructor of the Logger.
Sets up log file handlers for printing to console and to file, depending on the user settings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
logger_settings
|
LoggerSettings
|
Settings for initialization, see |
required |
log
¶
Log statistics with given values to initialized file handlers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
log_values
|
Iterable[LogValue]
|
List of log values |
required |
header
¶
Log the table header to console and file.
This method should be invoked once at the beginning of the logging process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
log_values
|
Iterable[LogValue]
|
List of log values |
required |
info
¶
Wrapper to Python logger info
call.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
str
|
Message to log |
required |