Switch to LokiQueueHandler
This commit is contained in:
parent
c9ba680bbf
commit
2718e72a80
@ -8,9 +8,8 @@ def init_loki_logging(config: dict[str, str]):
|
|||||||
"""Configures the logging to Loki."""
|
"""Configures the logging to Loki."""
|
||||||
import logging_loki
|
import logging_loki
|
||||||
|
|
||||||
queue = Queue(-1)
|
handler = logging_loki.LokiQueueHandler(
|
||||||
handler = logging.handlers.QueueHandler(queue)
|
Queue(-1),
|
||||||
handler_loki = logging_loki.LokiHandler(
|
|
||||||
url=config["loki"]["url"],
|
url=config["loki"]["url"],
|
||||||
version="1",
|
version="1",
|
||||||
tags={
|
tags={
|
||||||
@ -22,7 +21,6 @@ def init_loki_logging(config: dict[str, str]):
|
|||||||
datefmt="%Y-%m-%d-%H:%M:%S",
|
datefmt="%Y-%m-%d-%H:%M:%S",
|
||||||
)
|
)
|
||||||
handler.setFormatter(formatter)
|
handler.setFormatter(formatter)
|
||||||
logging.handlers.QueueListener(queue, handler_loki)
|
|
||||||
logging.getLogger().addHandler(handler)
|
logging.getLogger().addHandler(handler)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user