Telemetry-based audit logging for Jido.Messaging events.
Attaches to telemetry events and logs them using Elixir's Logger. Provides structured audit trails for all significant messaging events.
Usage
# Attach to all events with default settings
Jido.Messaging.AuditLogger.attach()
# Attach with options
Jido.Messaging.AuditLogger.attach(
log_level: :info,
include_typing: false, # Don't log typing events (can be noisy)
prefix: "audit"
)
# Detach when no longer needed
Jido.Messaging.AuditLogger.detach()Logged Events
All events are logged with structured metadata including:
room_id- the room where the event occurredinstance_module- the messaging moduletimestamp- when the event occurredcorrelation_id- for tracing related events
Message Events
[:jido_messaging, :message, :received][:jido_messaging, :message, :sent][:jido_messaging, :message, :failed][:jido_messaging, :message, :delivered][:jido_messaging, :message, :read][:jido_messaging, :message, :reaction_added][:jido_messaging, :message, :reaction_removed]
Participant Events
[:jido_messaging, :participant, :presence_changed][:jido_messaging, :participant, :typing](optional, disabled by default)
Thread Events
[:jido_messaging, :thread, :created][:jido_messaging, :thread, :reply_added]
Summary
Functions
Attach the audit logger to all Jido.Messaging telemetry events.
Detach the audit logger from telemetry events.
Functions
@spec attach(keyword()) :: :ok | {:error, :already_exists}
Attach the audit logger to all Jido.Messaging telemetry events.
Options
:log_level- Logger level to use (default::info):include_typing- Whether to log typing events (default:false):prefix- Prefix for log messages (default:"Jido.Messaging.Audit")
@spec detach() :: :ok | {:error, :not_found}
Detach the audit logger from telemetry events.