Logging

Logging.

mdacli.logger.check_suffix(filename: str | Path, suffix: str) str | Path[source]

Check the suffix of a file name and adds if it not existing.

If filename does not end with suffix the suffix is added and a warning will be issued.

Parameters:
  • filename (Name of the file to be checked.)

  • suffix (Expected file suffix i.e. .txt.)

Returns:

Checked and probably extended file name.

mdacli.logger.setup_logging(logobj: Logger, logfile: str | Path | None = None, level: int = 30)[source]

Create a logging environment for a given log_obj.

Parameters:
  • logobj (logging.Logger) – A logging instance

  • logfile (str) – Name of the log file

  • level (int) – Set the root logger level to the specified level. If for example set to logging.DEBUG detailed debug logs inludcing filename and function name are displayed. For logging.INFO only the message logged from errors, warnings and infos will be displayed.