Use 'level' instead of 'severity'
Opened this issue · 4 comments
MartijnVanAndel commented
Loki and Grafana use level
as label to show the logging severity/verbose/levelname. It would be useful to replace the current severity
label with level
, as all queries and visualizations in Grafana would automatically pick up the log level.
I can create a pull request if you like, but let me know if the current has a special purpose.
Apollo3zehn commented
Apollo3zehn commented
It seems the level tag can be easily changed with the following code:
import logging
from logging_loki import LokiHandler, emitter
emitter.LokiEmitter.level_tag = "level"
handler = LokiHandler(
url="<url>",
tags={"app": "<appname>"},
version="1",
)
logger = logging.getLogger("<loggername>")
logger.addHandler(handler)
logger.error(
"Something happened",
extra={"tags": {"service": "my-service"}},
)
edeno1 commented
Hi, the logger only supports error I can send logs to Loki but I perform logger.info he does not write it to Loki