pydit.logger.setup_logging

pydit.logger.setup_logging(logfile='./audit.log', level_screen=20, level_file=20)[source]

Configure the logging both to screen and a file with sensible parameters

By default it will generate an audit.log file with daily rotation kept 7 days. You can explore changing this to other kind of rotation/retention criteria. By default it will log at INFO level. I tried with DEBUG but some libraries start to log a lot of garbage (e.g. faker) and I had to settle on INFO.

Parameters:
  • logfile (str, optional, default "./audit.log") – Path to the log file

  • level_screen (int, optional, default logging.INFO) – Level of logging to screen

  • level_file (int, optional, default logging.INFO) – Level of logging to file

Returns:

logger – The logger object

Return type:

logging.Logger