Skip to content

Commit

Permalink
Use configured logging
Browse files Browse the repository at this point in the history
  • Loading branch information
TheByronHimes committed Jan 12, 2024
1 parent 47c687e commit 01fa26f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/ns/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,24 @@
"""Config Parameter Modeling and Parsing"""

from hexkit.config import config_from_yaml
from hexkit.log import LoggingConfig
from hexkit.providers.akafka import KafkaConfig

from ns.adapters.inbound.akafka import EventSubTranslatorConfig
from ns.adapters.outbound.smtp_client import SmtpClientConfig
from ns.core.notifier import NotifierConfig

SERVICE_NAME = "ns"

@config_from_yaml(prefix="ns")
class Config(KafkaConfig, EventSubTranslatorConfig, SmtpClientConfig, NotifierConfig):

@config_from_yaml(prefix=SERVICE_NAME)
class Config(
KafkaConfig,
EventSubTranslatorConfig,
SmtpClientConfig,
NotifierConfig,
LoggingConfig,
):
"""Config parameters and their defaults."""

service_name: str = "ns"
service_name: str = SERVICE_NAME
4 changes: 4 additions & 0 deletions src/ns/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#
"""Top-level DI Container and consumer creation, entry point is consume_events()"""

from hexkit.log import configure_logging

from ns.config import Config
from ns.inject import prepare_event_subscriber

Expand All @@ -23,5 +25,7 @@ async def consume_events(run_forever: bool = True):
"""Start consuming events with kafka"""
config = Config() # type: ignore [call-arg]

configure_logging(config=config)

async with prepare_event_subscriber(config=config) as event_subscriber:
await event_subscriber.run(forever=run_forever)

0 comments on commit 01fa26f

Please sign in to comment.