pub struct EventLog { /* private fields */ }Expand description
Local JSONL event log. Disabled (no-op) unless explicitly enabled.
Construct with EventLog::from_env for the documented opt-in behavior,
or with EventLog::new / EventLog::disabled to pin a specific
state (tests, adapters).
Implementations§
Source§impl EventLog
impl EventLog
Sourcepub fn disabled() -> Self
pub fn disabled() -> Self
A disabled log: Self::record is a no-op that writes nothing.
Sourcepub fn new(path: impl Into<PathBuf>) -> Self
pub fn new(path: impl Into<PathBuf>) -> Self
An enabled log pinned to a specific JSONL file path.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Resolve from the environment.
Enabled iff AUTH_CLOUDFLARE_OBSERVABILITY is exactly "1". The log
path is AUTH_CLOUDFLARE_EVENT_LOG when set, otherwise
~/.hermes/auth-cloudflare/events.jsonl (respecting HERMES_HOME).
Any other value - including unset - yields a disabled no-op log.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
True when events will actually be written.
Sourcepub fn record(&self, event: Event) -> Result<(), Error>
pub fn record(&self, event: Event) -> Result<(), Error>
Append one event as a single JSON line.
No-op (returns Ok(())) when disabled. When enabled, the parent
directory is created if needed, the file is opened in append mode,
and the JSON object plus trailing newline is written in a single
write_all. The file is created user-private (mode 0o600 on Unix).