[issue34844] logging.Formatter enhancement - Checking on style and fmt fields

2018-10-16 Thread Vinay Sajip


Change by Vinay Sajip :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34844] logging.Formatter enhancement - Checking on style and fmt fields

2018-10-15 Thread Guido van Rossum


Guido van Rossum  added the comment:

W00t! Congrats Luna and thanks for your contribution. Thanks Vinay for the 
prompt reviews!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34844] logging.Formatter enhancement - Checking on style and fmt fields

2018-10-15 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 18fb1fb943b7dbd7f8a76017ee2a67ef13effb85 by Vinay Sajip 
(BNMetrics) in branch 'master':
bpo-34844: logging.Formatter enhancement - Ensure style and format string 
matches in logging.Formatter  (GH-9703)
https://github.com/python/cpython/commit/18fb1fb943b7dbd7f8a76017ee2a67ef13effb85


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34844] logging.Formatter enhancement - Checking on style and fmt fields

2018-10-05 Thread Vinay Sajip


Vinay Sajip  added the comment:

I see a PR has been added, I'll start to review it after the CLA has been 
signed.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34844] logging.Formatter enhancement - Checking on style and fmt fields

2018-10-04 Thread Luna Chen


Change by Luna Chen :


--
keywords: +patch
pull_requests: +9088
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34844] logging.Formatter enhancement - Checking on style and fmt fields

2018-10-01 Thread Luna Chen


Luna Chen  added the comment:

Thank you Vinay!
I think you have some good points! :)

I'm going to make the following changes
- re-raise the keyError into ValueError in XXXStyle.format
- add validate() methods to XXXstyle class, and call them in logging.Formatter

Best regards,
Luna Chen

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34844] logging.Formatter enhancement - Checking on style and fmt fields

2018-09-30 Thread Vinay Sajip


Vinay Sajip  added the comment:

> 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.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34844] logging.Formatter enhancement - Checking on style and fmt fields

2018-09-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

Moving to Python 3.8 because this is a feature proposal. Adding Vinay to nosy 
list because this is about logging.

--
nosy: +vinay.sajip
versions: +Python 3.8 -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34844] logging.Formatter enhancement - Checking on style and fmt fields

2018-09-29 Thread Luna Chen


Change by Luna Chen :


--
title: logging.Formatter enhancement - Checking on style and -> 
logging.Formatter enhancement - Checking on style and fmt fields

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com