This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vinay.sajip
Recipients BNMetrics, gvanrossum, vinay.sajip
Date 2018-10-01.05:37:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Checking fmt to match the style in the constructor of logging.Formatter

This seems a reasonable change to want to make. You would need to parse the format string for fields using the appropriate style. This should probably be via a validate() method in each of the XXXStyle classes, which is passed the format string and raises an exception if invalid.

> I would like to have custom fields passed in as an additional (optional) argument into the constructor for logging.Formatter

If this is just a list of custom field names, it could be inferred from the passed format string, which will now be being parsed for fields for the checking described above. So there should be no need to pass an additional argument.

> With this, we can remove the "extra" argument in Logger.makeRecord()

We can't do this, because of the need to maintain backwards compatibility. Note also that custom fields can be introduced into a LogRecord in other ways, e.g. using Filters.

> the "KeyError" here can be misleading and confusing

It seems reasonable to make a change to re-raise such a KeyError using a more informative error message, perhaps as a ValueError.
Date User Action Args
2018-10-01 05:37:52vinay.sajipsetrecipients: + vinay.sajip, gvanrossum, BNMetrics
2018-10-01 05:37:52vinay.sajipsetmessageid: <>
2018-10-01 05:37:52vinay.sajiplinkissue34844 messages
2018-10-01 05:37:51vinay.sajipcreate