wiz.logging

wiz.logging.LEVEL_MAPPING = {'debug': 10, 'error': 40, 'info': 20, 'warning': 30}

Available levels with corresponding labels.

wiz.logging.PATH = '/tmp/wiz/logs'

Output path for files exported by default ‘file’ handler.

wiz.logging.DEFAULT_CONFIG = {'formatters': {'detailed': {'class': 'logging.Formatter', 'format': '%(asctime)s - %(levelname)s - %(name)s - %(message)s'}, 'standard': {'class': 'coloredlogs.ColoredFormatter', 'format': '%(message)s'}}, 'handlers': {'console': {'class': 'logging.StreamHandler', 'formatter': 'standard', 'level': 20, 'stream': 'ext://sys.stdout'}, 'file': {'backupCount': 20, 'class': 'logging.handlers.RotatingFileHandler', 'filename': '/tmp/wiz/logs/docs.log', 'formatter': 'detailed', 'level': 20, 'maxBytes': 10485760}}, 'root': {'handlers': ['console', 'file'], 'level': 10}, 'version': 1}

Default configuration for logger.

wiz.logging.initiate(console_level='info')[source]

Initiate logger configuration.

Parameters:console_level – Initialize the logging level for the console handler if possible. Default is “info”.
wiz.logging.capture_logs(error_stream, warning_stream)[source]

Initialize logger to capture error and warning level.

Parameters:
  • error_stream – instances of io.StringIO which will receive all errors logged.
  • warning_stream – instances of io.StringIO which will receive all warnings logged.