pub struct DiagnosticsCollector { /* private fields */ }Expand description
Central coordinator for diagnostic logging.
Checks RALPH_DIAGNOSTICS environment variable and creates a timestamped
session directory if enabled.
Implementations§
Source§impl DiagnosticsCollector
impl DiagnosticsCollector
Sourcepub fn new(base_path: &Path) -> Result<Self>
pub fn new(base_path: &Path) -> Result<Self>
Creates a new diagnostics collector.
If RALPH_DIAGNOSTICS=1, creates .ralph/diagnostics/<timestamp>/ directory.
Sourcepub fn with_enabled(base_path: &Path, enabled: bool) -> Result<Self>
pub fn with_enabled(base_path: &Path, enabled: bool) -> Result<Self>
Creates a diagnostics collector with explicit enabled flag (for testing).
Sourcepub fn disabled() -> Self
pub fn disabled() -> Self
Creates a disabled diagnostics collector without any I/O (for testing).
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns whether diagnostics are enabled.
Sourcepub fn session_dir(&self) -> Option<&Path>
pub fn session_dir(&self) -> Option<&Path>
Returns the session directory if diagnostics are enabled.
Sourcepub fn wrap_stream_handler<H>(
&self,
handler: H,
) -> Result<DiagnosticStreamHandler<H>, H>
pub fn wrap_stream_handler<H>( &self, handler: H, ) -> Result<DiagnosticStreamHandler<H>, H>
Wraps a stream handler with diagnostic logging.
Returns the original handler if diagnostics are disabled.
Sourcepub fn log_orchestration(
&self,
iteration: u32,
hat: &str,
event: OrchestrationEvent,
)
pub fn log_orchestration( &self, iteration: u32, hat: &str, event: OrchestrationEvent, )
Logs an orchestration event.
Does nothing if diagnostics are disabled.
Sourcepub fn log_performance(
&self,
iteration: u32,
hat: &str,
metric: PerformanceMetric,
)
pub fn log_performance( &self, iteration: u32, hat: &str, metric: PerformanceMetric, )
Logs a performance metric.
Does nothing if diagnostics are disabled.
Sourcepub fn log_error(&self, iteration: u32, hat: &str, error: DiagnosticError)
pub fn log_error(&self, iteration: u32, hat: &str, error: DiagnosticError)
Logs an error.
Does nothing if diagnostics are disabled.
Auto Trait Implementations§
impl Freeze for DiagnosticsCollector
impl RefUnwindSafe for DiagnosticsCollector
impl Send for DiagnosticsCollector
impl Sync for DiagnosticsCollector
impl Unpin for DiagnosticsCollector
impl UnsafeUnpin for DiagnosticsCollector
impl UnwindSafe for DiagnosticsCollector
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
Source§impl<T> Erasable for T
impl<T> Erasable for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more