madzak / python-json-logger

Json Formatter for the standard python logger
BSD 2-Clause "Simplified" License
1.7k stars 231 forks source link

Fix too strict regex for pecentage style logging #143

Closed aberres closed 1 year ago

aberres commented 1 year ago

The regression was introduced in 0055dc5b273949ee7432665eeddbe37781d9dc01.

Only fields followed by an s were correctly extracted. As there are other possible cases like 8s, d, or no prefix at all the regex is loosened.

In this funky case [%(levelname)8s][PID %(process)d][%(threadName)s] the extracted field was levelname)8s][PID %(process)d][%(threadName.

madzak commented 1 year ago

Thanks for fixing & adding a test case!