scoro: log directly to loki
This commit is contained in:
@@ -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/"
|
||||
|
||||
@@ -2,3 +2,4 @@ mido
|
||||
requests
|
||||
black-with-tabs
|
||||
validated-dc
|
||||
python-logging-loki
|
||||
Reference in New Issue
Block a user