logging.setLogRecordFactory()

logging.setLogRecordFactory(factory)

Set a callable which is used to create a LogRecord.

Parameters: factory – The factory callable to be used to instantiate a log record.

New in version 3.2: This function has been provided, along with getLogRecordFactory(), to allow developers more control over how the LogRecord representing a logging event is constructed.

The factory has the following signature:

factory(name, level, fn, lno, msg, args, exc_info, func=None, sinfo=None, **kwargs)

name: The logger name.
level: The logging level (numeric).
fn: The full pathname of the file where the logging call was made.
lno: The line number in the file where the logging call was made.
msg: The logging message.
args: The arguments for the logging message.
exc_info: An exception tuple, or None.
func: The name of the function or method which invoked the logging call.
sinfo: A stack traceback such as is provided by traceback.print_stack(), showing the call hierarchy.
kwargs: Additional keyword arguments.
doc_python
2016-10-07 17:36:26
Comments
Leave a Comment

Please login to continue.