scoro: log directly to loki

This commit is contained in:
GitBluub
2023-09-19 17:11:42 +02:00
parent 611ab57c5d
commit 23e5941700
2 changed files with 13 additions and 1 deletions

View File

@@ -7,7 +7,8 @@ import os
import sys
from typing import TypedDict
from pathlib import Path
import logging_loki
from multiprocessing import Queue
import requests
from chroma_case.Key import Key
from chroma_case.Message import (
@@ -31,6 +32,16 @@ Path(logname).touch(exist_ok=True)
logging.basicConfig(filename=logname,
filemode='a', level=logging.DEBUG)
handler = logging_loki.LokiQueueHandler(
Queue(-1),
url="http://gateway:3100/loki/api/v1/push",
tags={"application": "scorometer"},
version="1",
)
logger = logging.getLogger()
logger.addHandler(handler)
BACK_URL = os.environ.get("BACK_URL") or "http://back:3000"
MUSICS_FOLDER = os.environ.get("MUSICS_FOLDER") or "/assets/musics/"

View File

@@ -2,3 +2,4 @@ mido
requests
black-with-tabs
validated-dc
python-logging-loki