Message326763
> 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:52 | vinay.sajip | set | recipients:
+ vinay.sajip, gvanrossum, BNMetrics |
2018-10-01 05:37:52 | vinay.sajip | set | messageid: <1538372272.41.0.545547206417.issue34844@psf.upfronthosting.co.za> |
2018-10-01 05:37:52 | vinay.sajip | link | issue34844 messages |
2018-10-01 05:37:51 | vinay.sajip | create | |
|