rattail.logging

Logging Utilities

class rattail.logging.RattailAdapter(logger)[source]

Adds various items to a logger’s context.

Specifically, this adds the following keys to the extra dictionary available to the logger’s formatter(s):

  • 'hostname' - The fully-qualified domain name of the host machine.
  • 'hostip' - The IPv4 address of the host machine.
  • 'argv' - The value of sys.argv (a list).
  • 'uid' - The effective UID of the running process.
  • 'username' - The login name of the effective user.
class rattail.logging.TimeConverter(config)[source]

Custom time converter for use with logging formatters. Makes sure the final effective time zone for logged timestamps is the “default” one.

rattail.logging.get_logger(name)[source]

Fetches a logger by name, and wraps it in an adapter.

This is intended to effectively replace the logging.getLogger() function. It does the same thing, except for wrapping the logger within a RattailAdapter.