biofx.utils package¶
Submodules¶
biofx.utils.LogUtils module¶
@cchng
Logging utilities that fulfill OMICS group requirements.
-
class
biofx.utils.LogUtils.
Masker
(patterns)[source]¶ Bases:
logging.Filter
References
-
class
biofx.utils.LogUtils.
OMICSLogger
[source]¶ Bases:
object
Logger based on OMICS code template.
-
static
generate_status_file_names
(outdir, program_name, prefix='', *status)[source]¶ Generate status file names.
Parameters: - outdir (string) – output directory path
- program_name (string) – program name
- prefix (string) – file prefix
- *status – status stamps as file extensions
Returns: a tuple containing file names in the order of status provided
Return type:
-
init_logging
(output_level=20, file_level=20, log_file_name=None, overwrite=False, logger_name='')[source]¶ initialize the logging with default parameter. If use several time with same input file only the level of the logging will be change.
Parameters: - output_level (int) – The logging level of output for the stdout. If set to None the stdout is not set or not changed. default: INFO.
- file_level (int) – The logging level of output for the log file. if set to None the logging in a file is not set or not changed. default: INFO.
- log_file_name (str) – The name of the file used for the logging. if set to None the logging in a file is not set or not changed. default: None.
- overwrite (bool) – if set to true an existing log file will overwritten, otherwise the next logg will be append. default: None.
- logger_name (string) – untested. DO NOT USE
Example
init_logging() –> set the stdout only to INFO init_logging(log_file_name=”any_file”) –> set the stdout and the log file to INFO init_logging(output_level=None, log_file_name=”any_file”) –> set the log file only to INFO don’t touch the stdout
-
log_run_info
(program, version, dependencies, options=None)[source]¶ Parameters: - program (string) – name of program. usually file name
- version (string) – program version
- dependencies (dict) – a dictionary of dependency name as keys and dependency as values
- options (OptParser) – an instance of Optparser
-
static
log_section
(section, width=None, marker='=')[source]¶ Formatted section string for logging. :param section: section name :type section: string :param width: screen width :type width: int :param marker: single character string to mark section :type marker: string
-
run_fail
(failurefilename=None, exit_program=True, exit_status=1)[source]¶ Fail analysis.
Parameters: - failurefilename (string) – failure status file path
- exit_program (boolean) – exit program if True
- exit_status (int) – exit status. used if exit_program is True
-
static