14.5.8 LogRecord Objects

LogRecord instances are created every time something is logged. They contain all the information pertinent to the event being logged. The main information passed in is in msg and args, which are combined using msg % args to create the message field of the record. The record also includes information such as when the record was created, the source line where the logging call was made, and any exception information to be logged.

class LogRecord( name, lvl, pathname, lineno, msg, args, exc_info [, func])
Returns an instance of LogRecord initialized with interesting information. The name is the logger name; lvl is the numeric level; pathname is the absolute pathname of the source file in which the logging call was made; lineno is the line number in that file where the logging call is found; msg is the user-supplied message (a format string); args is the tuple which, together with msg, makes up the user message; and exc_info is the exception tuple obtained by calling sys.exc_info() (or None, if no exception information is available). The func is the name of the function from which the logging call was made. If not specified, it defaults to None. Changed in version 2.5: func was added.

getMessage( )
Returns the message for this LogRecord instance after merging any user-supplied arguments with the message.

See About this document... for information on suggesting changes.