pub struct EventLogger { /* private fields */ }Expand description
Logger that writes events to a JSONL file.
Implementations§
Source§impl EventLogger
impl EventLogger
Sourcepub const DEFAULT_PATH: &'static str = ".ralph/events.jsonl"
pub const DEFAULT_PATH: &'static str = ".ralph/events.jsonl"
Default path for the events file.
Sourcepub fn new(path: impl Into<PathBuf>) -> Self
pub fn new(path: impl Into<PathBuf>) -> Self
Creates a new event logger.
The .ralph/ directory is created if it doesn’t exist.
Sourcepub fn default_path() -> Self
pub fn default_path() -> Self
Creates a logger with the default path.
Sourcepub fn from_context(context: &LoopContext) -> Self
pub fn from_context(context: &LoopContext) -> Self
Creates a logger using the events path from a LoopContext.
This reads the timestamped events path from the marker file if it exists, falling back to the default events path. This ensures the logger writes to the correct location when running in a worktree or other isolated workspace.
Sourcepub fn log(&mut self, record: &EventRecord) -> Result<()>
pub fn log(&mut self, record: &EventRecord) -> Result<()>
Logs an event record.
Uses a single write_all call to ensure the JSON line is written atomically.
This prevents corruption when multiple processes append to the same file
concurrently (e.g., during parallel merge queue processing).
Auto Trait Implementations§
impl Freeze for EventLogger
impl RefUnwindSafe for EventLogger
impl Send for EventLogger
impl Sync for EventLogger
impl Unpin for EventLogger
impl UnwindSafe for EventLogger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more