ExESDB.LoggingPublisher (ex_esdb v0.11.0)

Helper module for publishing structured logging events to the :ex_esdb_logging PubSub topic.

This module provides a clean API for components to publish logging events instead of using direct terminal output.

Summary

Functions

action(component, store_id, message, metadata \\ %{})

error(component, store_id, message, metadata \\ %{})

health(component, store_id, message, metadata \\ %{})

publish(component, event_type, store_id, message, metadata \\ %{})

Publishes a logging event to the appropriate topic.

Parameters

  • component: The component type (e.g., :emitter_pool, :emitter_worker, :emitter_system)
  • event_type: The type of event (e.g., :startup, :shutdown, :action, :health, :error)
  • store_id: The store identifier
  • message: The log message
  • metadata: Additional metadata (default: %{})

Examples

iex> LoggingPublisher.publish(:emitter_pool, :startup, :my_store, "Pool started", %{pool_size: 3})
:ok

iex> LoggingPublisher.publish(:emitter_worker, :action, :my_store, "Processing event", %{event_id: "123"})
:ok

shutdown(component, store_id, message, metadata \\ %{})

startup(component, store_id, message, metadata \\ %{})

Convenience functions for common logging scenarios