Title: logging LogRecordFactory allow kwargs
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.6
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: palaviv, vinay.sajip
Priority: normal Keywords: patch

Created on 2016-01-09 14:12 by palaviv, last changed 2016-01-11 20:05 by vinay.sajip. This issue is now closed.

File name Uploaded Description Edit palaviv, 2016-01-09 14:12 use case.
LogRecordFactoryKwargs.patch palaviv, 2016-01-09 14:14 patch for the problem review
Messages (3)
msg257831 - (view) Author: Aviv Palivoda (palaviv) * Date: 2016-01-09 14:12
The logging LogRecord factory receives kwargs. However because _log and makeRecord functions in the Logger class don't support kwargs we can't actually pass additional positional arguments to LogRecord.

A use case for this is attached.

I had made a patch to fix this by changing _log and makeRecord to accept kwargs and pass them.
msg257832 - (view) Author: Aviv Palivoda (palaviv) * Date: 2016-01-09 14:14
adding the patch :)
msg258005 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2016-01-11 20:05
That the LogRecord receives kwargs is an internal implementation detail - note that it is not mentioned in the documentation, and not even currently used there. If you want to pass additional information to be stored in the record, use the documented approach - which is to pass a dictionary in the "extra" keyword argument containing the additional fields to add.
Date User Action Args
2016-01-11 20:05:43vinay.sajipsetstatus: open -> closed
resolution: not a bug
messages: + msg258005
2016-01-09 14:14:43palavivsetfiles: + LogRecordFactoryKwargs.patch
keywords: + patch
messages: + msg257832
2016-01-09 14:12:01palavivcreate