mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-13 16:53:24 +00:00
fixup
This commit is contained in:
37
main.py
37
main.py
@ -14,26 +14,25 @@ class Main():
|
||||
def init_log_handlers(self):
|
||||
with open(".env.yaml", "r") as file:
|
||||
config = yaml.safe_load(file)
|
||||
if config["log"] is None:
|
||||
try:
|
||||
log_handler_confg = config["log"]["handlers"]
|
||||
log_handlers = [logging.StreamHandler()]
|
||||
for handler_config in log_handler_confg:
|
||||
if handler_config["type"] == "loki":
|
||||
log_handlers.append(LokiLoggerHandler(
|
||||
url=handler_config["url"],
|
||||
additional_headers={"X-Odin-Auth": handler_config["x-odin-auth"]},
|
||||
labels=handler_config["labels"],
|
||||
label_keys={},
|
||||
timeout=10,
|
||||
enable_structured_loki_metadata=True,
|
||||
loki_metadata={"service": "user-service", "version": "1.0.0"},
|
||||
insecure_ssl_verify=False
|
||||
))
|
||||
logging.basicConfig(level=logging.DEBUG, handlers=log_handlers)
|
||||
logging.info("logging init finish")
|
||||
except KeyError:
|
||||
return
|
||||
if config["log"]["handlers"] is None:
|
||||
return
|
||||
log_handler_confg = config["log"]["handlers"]
|
||||
log_handlers = [logging.StreamHandler()]
|
||||
for handler_config in log_handler_confg:
|
||||
if handler_config["type"] == "loki":
|
||||
log_handlers.append(LokiLoggerHandler(
|
||||
url=handler_config["url"],
|
||||
additional_headers={"X-Odin-Auth": handler_config["x-odin-auth"]},
|
||||
labels=handler_config["labels"],
|
||||
label_keys={},
|
||||
timeout=10,
|
||||
enable_structured_loki_metadata=True,
|
||||
loki_metadata={"service": "user-service", "version": "1.0.0"},
|
||||
insecure_ssl_verify=False
|
||||
))
|
||||
logging.basicConfig(level=logging.DEBUG, handlers=log_handlers)
|
||||
logging.info("logging init finish")
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.init_log_handlers()
|
||||
|
||||
Reference in New Issue
Block a user