slimta.logging

Utilities to make logging consistent and easy in slimta packages.

slimta.logging.getSocketLogger(name)

Wraps the result of logging.getLogger() in a SocketLogger object to provide limited and consistent logging output for socket operations.

Parameters:namename as passed in to logging.getLogger().
Return type:SocketLogger
slimta.logging.getSubprocessLogger(name)

Wraps the result of logging.getLogger() in a SubprocessLogger object to provide limited and consistent logging output for subprocess operations.

Parameters:namename as passed in to logging.getLogger().
Return type:SubprocessLogger
slimta.logging.getQueueStorageLogger(name)

Wraps the result of logging.getLogger() in a QueueStorageLogger object to provide limited and consistent logging output for QueueStorage operations.

Parameters:namename as passed in to logging.getLogger().
Return type:QueueStorageLogger
slimta.logging.getHttpLogger(name)

Wraps the result of logging.getLogger() in a HttpLogger object to provide limited and consistent logging output for WSGI-style requests and responses and other HTTP-related logs.

Parameters:namename as passed in to logging.getLogger().
Return type:HttpLogger
slimta.logging.log_exception(name[, **kwargs])

Logs an exception, along with relevant information such as message, traceback, and anything provided pertinent to the situation. This function does nothing unless called while an exception is being handled.

Parameters:
  • namename as passed in to logging.getLogger().
  • kwargs – Other keywords may be passed in and will be included in the produced log line.
slimta.logging.parseline(line)

Given a log line generated from slimta.logging, return a four-tuple of the following:

  1. The log type – e.g. 'socket'
  2. The log ID based on type – e.g. a file descriptor or PID
  3. The log operation – e.g. 'connect' or 'popen'
  4. The log data, a dictionary of relevant information
Parameters:line – The log line to parse, with or without new-line characters.
Raises:ValueError

Sub-Modules: