Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketmaurya committed Sep 20, 2024
1 parent 7d69837 commit 8fc2321
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/litserve/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,35 @@ def mount(self, path: str, app: ASGIApp) -> None:

@abstractmethod
def process(self, key, value):
"""Process a log entry from the log queue.
This method should be implemented to define the specific logic for processing
log entries.
Args:
key (str): The key associated with the log entry, typically indicating the type or category of the log.
value (Any): The value associated with the log entry, containing the actual log data.
Raises:
NotImplementedError: This method must be overridden by subclasses. If not, calling this method will raise
a NotImplementedError.
Example:
Here is an example of a Logger that logs monitoring metrics using Prometheus:
from prometheus_client import Counter
class PrometheusLogger(Logger):
def __init__(self):
super().__init__()
self._metric_counter = Counter('log_entries', 'Count of log entries')
def process(self, key, value):
# Increment the Prometheus counter for each log entry
self._metric_counter.inc()
print(f"Logged {key}: {value}")
"""
raise NotImplementedError


Expand Down

0 comments on commit 8fc2321

Please sign in to comment.