vklochan/python-logstash

Feature Request: Add level number/value to the logged fields.

exhuma opened this issue · 0 comments

Currently, the emitted messages only contain level names (f.ex. ERROR, CRITICAL, ...). Those names correspond to level values. Those names can be converted to/from their numeric values using logging.getLevelName. Additionally, the numeric values should be available on the log-record behind the attribute levelno:

>>> from logging import LogRecord
>>> import logging
>>> r = LogRecord('foo', logging.DEBUG, 'path', 11, 'msg', {}, False)
>>> r.levelno
10
>>> r.levelname
'DEBUG'

Adding the numeric level value makes it much easier to filter on the severity by simply filtering on everything greater than 40 for example.