Logging¶
pytiger uses the Python logging framework to generate messages and bubble them up through to handlers.
The legacy pytiger.logging.legacy.LegacySyslogger class replicates
old behaviour for a managed transition to the full framework.
pytiger.logging.legacy – Legacy logging module¶
New in version 1.0.0.
Defines a number of log level attributes and LegacySyslogger to
carry out the real work.
This module should not be used for new work, but is provided to smooth the transition from tclutils.log.
By default, log entries are sent to standard output and the system logger.
Four valid log level constants are provided at the module level:
- ERROR – a problem that means execution cannot, or should not continue
- WARNING – an unexpected situtation but execution will continue
- INFO – informational output not indicative of a problem e.g. progress messages
- DEBUG – a message that should only be emitted when debugging code
These constants may be used anywhere that a level is expected by
LegacySyslogger.
-
class
pytiger.logging.legacy.LegacySyslogger[source]¶ An object that looks a bit like a Python logging object so that we can transition more easily later.
Example usage:
>>> s = LegacySyslogger() >>> # Long hand: >>> s.log(WARNING, 'Unable to biggle') W: Unable to biggle >>> # Short hand: >>> s.warning('Could not frob; continuing') W: Could not frob, continuing >>> s.error('Abandon ship, all ye who run this') E: Abandon ship, all ye who run this
-
log_level¶ Minimum level at which to emit a log entry
-
log_to_stdout¶ Whether to log to stdout (True or False)
-
log_to_syslog¶ Whether to log to syslog (True or False)
-