mylogging.log_functions module

Internal module for functions that will be imported in __init__.py for shorter syntax. This module is mainly for writing docstrings.

mylogging.log_functions.critical(message: str, caption: str = '') None[source]

Same as warning, but usually describe error that stopped the application.

Parameters
  • message (str) – Any string content of error.

  • caption (str, optional) – Heading of error. Defaults to ‘User message’.

mylogging.log_functions.debug(message: str, caption: str = '') None[source]

Log debug info. Only difference with info is filtering level in config.

Parameters
  • message (str) – Message to be logged.

  • caption (str, optional) – Heading of warning. Defaults to ‘User message’.

mylogging.log_functions.error(message: str, caption: str = '') None[source]

Same as warn, but can be filtered different way with level. This is only for logging message. If you want to log error code, you can use function traceback.

Parameters
  • message (str) – Any string content of error.

  • caption (str, optional) – Heading of error. Defaults to ‘User message’.

mylogging.log_functions.info(message: str, caption: str = '') None[source]

Log info.

Parameters
  • message (str) – Message to be logged.

  • caption (str, optional) – Heading of warning. Defaults to ‘User message’.

mylogging.log_functions.print(message: str, caption: str = '', level: typing_extensions.Literal[DEBUG, INFO, WARNING, ERROR, CRITICAL] = 'DEBUG') None[source]

Log message without details (file, line etc.). Only difference with normal print is filter and level in config.

Parameters
  • message (str) – Message to be logged.

  • caption (str, optional) – Heading of warning. Defaults to ‘User message’.

  • level (Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]) – Print can have also levels same as logs to be able to filter. Defaults to “DEBUG”

mylogging.log_functions.traceback(message: str = '', caption: str = 'error_type', level: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] = 'ERROR', stack_level: int = 3, remove_frame_by_line_str: None | list = None) None[source]

Log message with current traceback as content. It means, that error was caught, but still something crashed.

Parameters
  • message (str) – Any string content of traceback.

  • caption (str, optional) – Caption of warning. If ‘error_type’, than Error type (e.g. ZeroDivisionError) is used. Defaults to ‘error_type’.

  • level (Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], optional) – Defaults to “DEBUG”.

  • stack_level (int, optional) – How many calls to log from error. Defaults to 3.

  • remove_frame_by_line_str (None | list, optional) – If there is some level in stack that should be omitted, add line here. Defaults to None.

mylogging.log_functions.warn(message: str, caption: str = '') None[source]

Raise warning - just message, not traceback. Can be colorized. Display of warning is based on warning settings. You can configure how to cope with warnings with function set_warnings with debug parameter. Instead of traceback_warning this is not from caught error. It usually bring some information good to know.

Parameters
  • message (str) – Any string content of warning.

  • caption (str, optional) – Heading of warning. Defaults to ‘User message’.