blackmamba.log

Logging module.

This module must not introduce dependency on any other Black Mamba modules and must be importable on any other platform.

Why custom module instead of the bundled one? Several reasons:

  • not to interfere with Pythonista logging settings,
  • unable to convince Pythonista to use my colors,
  • etc.

Default log level is INFO. You can use blackmamba.log.set_level to change effective log level. Available log levels are:

If you’d like to silent Black Mamba messages, it’s recommended to set log level to ERROR:

import blackmamba.log as log
log.set_level(log.ERROR)
blackmamba.log.ERROR = 40

Only errors are logged.

blackmamba.log.WARNING = 30

Only warnings and errors are logged.

blackmamba.log.INFO = 20

Informational messages, warnings and errors are logged.

blackmamba.log.DEBUG = 10

Debug, information messages, warnings and errors are logged.

blackmamba.log.NOTSET = 0

All messages are logged.

blackmamba.log.get_level() → int[source]

Return effective log level.

Returns:Effective log level.
blackmamba.log.set_level(level: int)[source]

Set effective log level.

Parameters:level – Log level to set.
blackmamba.log.debug(*args, **kwargs)[source]

Log message with DEBUG level.

Parameters:
  • args – Passed to print.
  • kwargs – Passed to print.
blackmamba.log.info(*args, **kwargs)[source]

Log message with INFO level.

Parameters:
  • args – Passed to print.
  • kwargs – Passed to print.
blackmamba.log.warn(*args, **kwargs)[source]

Log message with WARNING level.

Parameters:
  • args – Passed to print.
  • kwargs – Passed to print.
blackmamba.log.error(*args, **kwargs)[source]

Log message with ERROR level.

Parameters:
  • args – Passed to print.
  • kwargs – Passed to print.