Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
exhuma opened this issue Feb 24, 2017 · 0 comments
Open

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

exhuma opened this issue Feb 24, 2017 · 0 comments

Comments

@exhuma
Copy link

exhuma commented Feb 24, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant