class
Sepia::PerFileEventLogger
- Sepia::PerFileEventLogger
- Sepia::EventLoggerBackend
- Reference
- Object
Overview
Event logging backend that stores one file per object.
This is the default implementation that creates a separate JSON Lines file for each object, containing all events for that object in chronological order.
File Structure
storage_path/
├── Document/ # Regular object storage
└──.events/ # Event storage
└── Document/
└── doc - 123.jsonl # Events for doc-123
Event Format
Each line in the file is a JSON object:
{"ts":"2025-01-15T10:30:45Z","type":"created","gen":1,"meta":{}}
{"ts":"2025-01-15T11:15:22Z","type":"updated","gen":2,"meta":{"user":"alice"}}
Defined in:
sepia/event_logger.crConstructors
Instance Method Summary
-
#append_event(object : Serializable | Container, event_type : LogEventType, generation : Int32, metadata)
Append an event to the object's event file.
-
#base_path : String
The base storage path for events.
-
#base_path=(base_path : String)
The base storage path for events.
-
#read_events(object_class : Class, id : String) : Array(LogEvent)
Read all events for a specific object from its event file.
Instance methods inherited from class Sepia::EventLoggerBackend
append_event(object : Serializable | Container, event_type : LogEventType, generation : Int32, metadata)
append_event,
read_events(object_class : Class, id : String) : Array(LogEvent)
read_events,
should_log?(klass : Class) : Bool
should_log?
Constructor Detail
Instance Method Detail
def append_event(object : Serializable | Container, event_type : LogEventType, generation : Int32, metadata)
#
Append an event to the object's event file.
Creates the event file and directory structure if needed, then appends the event as a JSON line.
Parameters
- object : The Sepia object the event relates to
- event_type : Type of event (Created, Updated, Deleted)
- generation : Object generation number
- metadata : Optional metadata for the event
def base_path : String
#
The base storage path for events.
This is automatically detected from the current storage backend.
def base_path=(base_path : String)
#
The base storage path for events.
This is automatically detected from the current storage backend.