synthpop.synthpop_utils.synthpop_logging ======================================== .. py:module:: synthpop.synthpop_utils.synthpop_logging .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: synthpop.synthpop_utils.synthpop_logging.logger Classes ------- .. autoapisummary:: synthpop.synthpop_utils.synthpop_logging.SynthpopLogger Functions --------- .. autoapisummary:: synthpop.synthpop_utils.synthpop_logging.log_basic_statistics Module Contents --------------- .. py:class:: SynthpopLogger(name, level=logging.INFO, debug_file=os.path.join(SYNTHPOP_DIR, 'synthpop.logfile.log')) Bases: :py:obj:`logging.Logger` Instances 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. .. py:attribute:: level :value: 10 .. py:attribute:: stream_level :value: 15 .. py:attribute:: file_level :value: 15 .. py:attribute:: stream_logger .. py:attribute:: debugger .. py:attribute:: file_formatter .. py:attribute:: stream_formatter .. py:attribute:: debug_formatter .. py:attribute:: file_logging_enabled :value: False .. py:attribute:: temp_file :value: None .. py:attribute:: current_file :value: None .. py:attribute:: filelogger :value: None .. py:method:: setup_file_logging(stream_level, file_level=None) sets up the file logging. Parameters ---------- stream_level : int set level for stream file_level: int or None set level for stream if None it will be stream_level - 5 Returns ------- .. py:method:: create_info_section(msg) .. py:method:: create_info_subsection(msg, level=25) .. py:method:: save_log_file(file_path) .. py:method:: update_location(filename, no_log_file=False) Copy the logfile header to a new location and continues logging at the new location Parameters ---------- filename : str new logging location no_log_file : bool if True. replace the logging with a tmp file to prevent file logging .. py:method:: cleanup() .. py:method:: flush() .. py:method:: remove_file_handler() .. py:method:: log2file(level, msg, *args, **kwargs) Log a message only to the file handler of the specified logger. Parameters ---------- level : int The logging level of the message to log. msg : str The message to log. *args : positional arguments Additional positional arguments to include in the log message. **kwargs : keyword arguments Additional keyword arguments to include in the log message. Returns ------- None .. py:method:: log2stream(level, msg, *args, **kwargs) Log a message only to the stream handler of the specified logger. Parameters ---------- level : int The logging level of the message to log. msg : str The message to log. *args : positional arguments Additional positional arguments to include in the log message. **kwargs : keyword arguments Additional keyword arguments to include in the log message. Returns ------- None .. py:data:: logger .. py:function:: log_basic_statistics(df, var_name, criteria=None)