Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixTJDietrich committed Aug 17, 2024
1 parent 41efeed commit 03a0ad9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/webhook-ingest/app/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from fastapi import logger
from pydantic_settings import BaseSettings
from app.logger import logger


class Settings(BaseSettings):
Expand Down
5 changes: 5 additions & 0 deletions server/webhook-ingest/app/logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import logging
import sys

logger = logging.getLogger('uvicorn.error')
logger.setLevel(logging.DEBUG)
12 changes: 10 additions & 2 deletions server/webhook-ingest/app/nats_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fastapi import logger
from nats.aio.client import Client as NATS
from app.config import settings
from app.logger import logger


class NATSClient:
Expand All @@ -10,7 +10,15 @@ def __init__(self, nats_url: str, nats_auth_token: str):
self.nats_auth_token = nats_auth_token

async def connect(self):
await self.nc.connect(servers=self.nats_url, token=self.nats_auth_token)
await self.nc.connect(
servers=[self.nats_url],
token=self.nats_auth_token,
verbose=True,
pedantic=True,
max_reconnect_attempts=-1,
allow_reconnect=True,
reconnect_time_wait=2,
)
self.js = self.nc.jetstream()
logger.info(f"Connected to NATS at {self.nats_url}")

Expand Down

0 comments on commit 03a0ad9

Please sign in to comment.