madzak / python-json-logger

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

Fix regex for string template style #194

Open Thomasillo opened 1 month ago

Thomasillo commented 1 month ago

valid String template: '$asctime $level $message'

regex for string template in JsonFormatter.parse:

....
        elif isinstance(self._style, logging.StrFormatStyle):
            formatter_style_pattern = re.compile(r"\{(.+?)\}", re.IGNORECASE)
...

would require the string template to be '${asctime} ${level} ${message}'

nhairs commented 1 month ago

Hi @Thomasillo,

Just so you're aware it looks like python-json-logger is currently unmaintained, that said I am working on a maintained fork where I've opened a copy of this issue.