eventit_py.base_logger module

class eventit_py.base_logger.BaseEventLogger(default_event_type: Callable | None = None, **kwargs)

Bases: object

Base class for event logging.

This class provides a base implementation for event logging and serves as a template for subclasses to implement specific logging functionality.

Parameters:
  • default_event_type (Callable, optional) – The default event type to be used if not provided. Defaults to None.

  • **kwargs – Additional keyword arguments for configuring the logger.

_default_event_type

The default event type.

Type:

Callable

chosen_backend

The chosen backend for logging.

Type:

str

db_client

The database client for logging.

groups

The list of event groups.

Type:

list[str]

_default_event_group

The default event group.

Type:

str

builtin_metrics

The dictionary of built-in metrics.

Type:

dict[str, Callable]

custom_metrics

The dictionary of custom metrics.

Type:

dict[str, Callable]

event()

Wrapper function to be implemented in subclass

log_event()
register_custom_metric(metric: str, func: Callable)

Register a user-defined metric on name provided, to be retrieved using provided function

Parameters:
  • metric (str) – name of new metric

  • func (Callable) – function to retrieve specified metric

Raises:

ValueError – If metric specified by name already present in builtin_metrics or custom_metrics