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."""
|
||||
import logging_loki
|
||||
|
||||
queue = Queue(-1)
|
||||
handler = logging.handlers.QueueHandler(queue)
|
||||
handler_loki = logging_loki.LokiHandler(
|
||||
handler = logging_loki.LokiQueueHandler(
|
||||
Queue(-1),
|
||||
url=config["loki"]["url"],
|
||||
version="1",
|
||||
tags={
|
||||
@ -22,7 +21,6 @@ def init_loki_logging(config: dict[str, str]):
|
||||
datefmt="%Y-%m-%d-%H:%M:%S",
|
||||
)
|
||||
handler.setFormatter(formatter)
|
||||
logging.handlers.QueueListener(queue, handler_loki)
|
||||
logging.getLogger().addHandler(handler)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user