Logging
- class golem.core.log.Log(*args, **kwargs)[source]
Bases:
objectLog object to store logger singleton and log adapters
- Parameters
config_json_file –
jsonfile from which to collect the logger if specifiedoutput_logging_level – logging levels are the same as in standard python module ‘logging’
log_file – file to write logs in
- static setup_in_mp(logging_level: int, logs_dir: pathlib.Path)[source]
Preserves logger level and its records in a separate file for each process only if it’s a child one
- Parameters
logging_level – level of the logger from the main process
logs_dir – path to the logs directory
- get_adapter(prefix: str) golem.core.log.LoggerAdapter[source]
Get adapter to pass contextual information to log messages
- Parameters
prefix – prefix to log messages with this adapter. Usually, the prefix is the name of the class where the log came from
- _get_logger(config_file: str, logging_level: int, use_console: bool = True) logging.Logger[source]
Get logger object
- class golem.core.log.LoggerAdapter(logger: logging.Logger, extra: dict)[source]
Bases:
logging.LoggerAdapterThis class looks like logger but used to pass contextual information to the output along with logging event information
- process(msg, kwargs)[source]
Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs.
Normally, you’ll only need to override this one method in a LoggerAdapter subclass for your specific needs.
- exception(msg, *args, exc_info=True, **kwargs)[source]
Delegate an exception call to the underlying logger.
- golem.core.log.default_log(prefix: Optional[object] = 'default') golem.core.log.LoggerAdapter[source]
Default logger
- Parameters
prefix – adapter prefix to add it to log messages
- Returns
LoggerAdapterobject- Return type