synthpop.synthpop_utils.synthpop_logging
This module consist the logging class of the SynthPopFramework. It mainly works like a standard python logger. But can change the logging location and provided function to create sections in the logfile .
Attributes
Classes
Instances of the Logger class represent a single logging channel. A |
Functions
|
Module Contents
- class synthpop.synthpop_utils.synthpop_logging.SynthpopLogger(name, level=logging.INFO, debug_file=os.path.join(SYNTHPOP_DIR, 'synthpop.logfile.log'))
Bases:
logging.LoggerInstances of the Logger class represent a single logging channel. A “logging channel” indicates an area of an application. Exactly how an “area” is defined is up to the application developer. Since an application can have any number of areas, logging channels are identified by a unique string. Application areas can be nested (e.g. an area of “input processing” might include sub-areas “read CSV files”, “read XLS files” and “read Gnumeric files”). To cater for this natural nesting, channel names are organized into a namespace hierarchy where levels are separated by periods, much like the Java or Python package namespace. So in the instance given above, channel names might be “input” for the upper level, and “input.csv”, “input.xls” and “input.gnu” for the sub-levels. There is no arbitrary limit to the depth of nesting.
- level = 10
- stream_level = 15
- file_level = 15
- stream_logger
- debugger
- file_formatter
- stream_formatter
- debug_formatter
- file_logging_enabled = False
- temp_file = None
- current_file = None
- filelogger = None
- setup_file_logging(stream_level, file_level=None)
sets up the file logging.
Parameters
- stream_levelint
set level for stream
- file_level: int or None
set level for stream if None it will be stream_level - 5
Returns
- create_info_section(msg)
- create_info_subsection(msg, level=25)
- save_log_file(file_path)
- update_location(filename, no_log_file=False)
Copy the logfile header to a new location and continues logging at the new location
Parameters
- filenamestr
new logging location
- no_log_filebool
if True. replace the logging with a tmp file to prevent file logging
- cleanup()
- flush()
- remove_file_handler()
- log2file(level, msg, *args, **kwargs)
Log a message only to the file handler of the specified logger.
Parameters
Returns
None
- synthpop.synthpop_utils.synthpop_logging.logger
- synthpop.synthpop_utils.synthpop_logging.log_basic_statistics(df, var_name, criteria=None)