26 lines
824 B
Python
26 lines
824 B
Python
from .base_logger import LoggerBase
|
|
from infra.config.app_settings import app_settings
|
|
import json
|
|
|
|
|
|
class BusinessMetricLogger(LoggerBase):
|
|
def __init__(self, business_metrics: dict[str, any] = {}) -> None:
|
|
extra_fileds = {}
|
|
if business_metrics:
|
|
extra_fileds.update(business_metrics)
|
|
super().__init__(
|
|
logger_name=app_settings.BUSINESS_METRIC_LOG,
|
|
extra_fileds=extra_fileds,
|
|
)
|
|
|
|
|
|
async def log_metrics(self, business_metrics: dict[str, any] = {}) -> None:
|
|
return await super().log_event(
|
|
sender_id="business_metric_manager",
|
|
receiver_id="business_metric_logger",
|
|
subject="metrics",
|
|
event="logging",
|
|
properties=business_metrics,
|
|
text="business metric logged"
|
|
)
|