46 lines
1.6 KiB
Python
46 lines
1.6 KiB
Python
from .application_logger import ApplicationLogger
|
|
|
|
|
|
class ModuleLogger(ApplicationLogger):
|
|
def __init__(self, sender_id: str) -> None:
|
|
super().__init__()
|
|
self.event_sender_id = sender_id
|
|
self.event_receiver_id = "ModuleLogger"
|
|
self.event_subject = "module"
|
|
|
|
async def log_exception(self, exception: Exception, text: str = "Exception", properties: dict[str, any] = None) -> None:
|
|
return await super().log_exception(
|
|
sender_id=self.event_sender_id,
|
|
receiver_id=self.event_receiver_id,
|
|
subject=self.event_subject,
|
|
exception=exception,
|
|
text=text,
|
|
properties=properties,
|
|
)
|
|
|
|
async def log_info(self, text: str, data: dict[str, any] = None) -> None:
|
|
return await super().log_info(
|
|
sender_id=self.event_sender_id,
|
|
receiver_id=self.event_receiver_id,
|
|
subject=self.event_subject,
|
|
text=text,
|
|
properties=data,
|
|
)
|
|
|
|
async def log_warning(self, text: str, data: dict[str, any] = None) -> None:
|
|
return await super().log_warning(
|
|
sender_id=self.event_sender_id,
|
|
receiver_id=self.event_receiver_id,
|
|
subject=self.event_subject,
|
|
text=text,
|
|
properties=data,
|
|
)
|
|
|
|
async def log_error(self, text: str, data: dict[str, any] = None) -> None:
|
|
return await super().log_error(
|
|
sender_id=self.event_sender_id,
|
|
receiver_id=self.event_receiver_id,
|
|
subject=self.event_subject,
|
|
text=text,
|
|
properties=data,
|
|
) |