pub struct LogOnlyObserver { /* private fields */ }Expand description
tui=off observer. Holds the actor handle so every event
also lands in the snapshot.
Stderr writes are coordinated: this observer only writes
directly when sink_active is false. When a
crate::log_only_sink::LogOnlySink (or any other
log-rendering crate::display_sink::DisplaySink) is up, it
flips sink_active = true and takes over rendering by
draining the actor’s snapshot. The handoff is racy by design:
any line that fires before the sink sets the flag goes
straight to stderr (matching legacy StderrObserver timing
for early diagnostics); after the flag flips, the sink owns
the channel.
Pre-flag lines are also written to the actor, so the sink’s
initial snapshot read sees them — but the sink’s first poll
records last_seen_seq = current log_seq_total and only
renders entries newer than that. No duplicates.
Implementations§
Source§impl LogOnlyObserver
impl LogOnlyObserver
Sourcepub fn new(state: RunStateHandle, cadences: Cadences) -> Self
pub fn new(state: RunStateHandle, cadences: Cadences) -> Self
Build with the given actor handle, default Info stderr
severity floor, and the user-declared cadences.
Sourcepub fn with_min_level(self, level: LogLevel) -> Self
pub fn with_min_level(self, level: LogLevel) -> Self
Override the stderr severity floor. The session log file is unaffected.
Sourcepub fn reserve_console_for_adapter(self) -> Self
pub fn reserve_console_for_adapter(self) -> Self
The console-owning-adapter display mode: a console-owning adapter
(stdout to a terminal, plotter) holds an interactive terminal,
so its compositing rule is don’t project to the console at all —
the screen is the adapter’s. This yields the whole console
projection (sink_active, the same flag a real sink raises to
claim the surface) and the inline ✓ status line
(inline_suppress). Every signal — banners, the scope/phase
readouts, completion notices — still flows through the channel to
session.log (the file write in
[crate::observer::log_categorized] is independent of these
flags); it just isn’t rendered to this surface.
Only applied on an interactive TTY: a non-interactive run (pipe/file) keeps stdout and stderr as separate streams, so the console projection flows to stderr as usual and CI/tests capture it.
Sourcepub fn sink_active_flag(&self) -> Arc<AtomicBool> ⓘ
pub fn sink_active_flag(&self) -> Arc<AtomicBool> ⓘ
Returns the shared coordination flag. The owner of the
active log-rendering sink flips this to true while
rendering and back to false on shutdown. This is the
hand-off the observer uses to decide whether to write
stderr directly.
Sourcepub fn inline_suppress_flag(&self) -> Arc<AtomicBool> ⓘ
pub fn inline_suppress_flag(&self) -> Arc<AtomicBool> ⓘ
Returns the inline-status suppression flag. Distinct
from sink_active_flag — this one’s job is to tell the
activity’s inline-status thread (the \r\x1b[K…
per-cycle rewriter in nmbrs-runtime::activity) to
yield while an alt-screen TUI owns the terminal. Held
high by the supervisor when TuiSink is up; held low
(or unset) in plain tui=terminal mode so the live
status line stays visible alongside the log-line drain.
Sourcepub fn min_level(&self) -> LogLevel
pub fn min_level(&self) -> LogLevel
The minimum severity threshold this observer was built with. The active sink reads this so its drain applies the same filter the observer would have, keeping output consistent across the synchronous-pre-sink and asynchronous-post-sink legs.
Sourcepub fn subscribe_frames(&self) -> Receiver<MetricSet>
pub fn subscribe_frames(&self) -> Receiver<MetricSet>
Subscribe to the cadence-frame fan-out. Returns a fresh
mpsc::Receiver; the caller (a sink) owns it for its
lifetime. Cleanup is automatic — when the receiver is
dropped, the broker prunes the matching sender on the
next publish. Multiple subscribers coexist (toggle path
hands out separate receivers to terminal- and TUI-side
sinks).
Sourcepub fn metrics_query(&self) -> Option<Arc<MetricsQuery>>
pub fn metrics_query(&self) -> Option<Arc<MetricsQuery>>
Snapshot of the metrics query handle published by the
runner via RunObserver::on_metrics_query. Returns
None until the cadence reporter is built — sinks that
need it (TuiSink) call this at start-time, when the
runner has already wired the query.
Trait Implementations§
Source§impl RunObserver for LogOnlyObserver
impl RunObserver for LogOnlyObserver
Source§fn op_measure(&self, parent_phase: SceneNodeId, op_name: &str, text: &str)
fn op_measure(&self, parent_phase: SceneNodeId, op_name: &str, text: &str)
measure: template at
completion — “12 sstables”, “1.4 GiB”, “98.1%”. Read moreSource§fn session_dir_ready(&self, dir: &Path)
fn session_dir_ready(&self, dir: &Path)
Source§fn sysmon_update(&self, sample: &SysmonSample)
fn sysmon_update(&self, sample: &SysmonSample)
Source§fn scenario_pre_mapped(&self, tree: &SceneTree)
fn scenario_pre_mapped(&self, tree: &SceneTree)
Source§fn phase_starting(
&self,
scene_node_id: SceneNodeId,
name: &str,
labels: &str,
op_templates: usize,
total_cycles: u64,
concurrency: usize,
)
fn phase_starting( &self, scene_node_id: SceneNodeId, name: &str, labels: &str, op_templates: usize, total_cycles: u64, concurrency: usize, )
Source§fn phase_completed(
&self,
scene_node_id: SceneNodeId,
name: &str,
labels: &str,
duration_secs: f64,
)
fn phase_completed( &self, scene_node_id: SceneNodeId, name: &str, labels: &str, duration_secs: f64, )
scene_node_id keys the
node to flip (see Self::phase_starting).Source§fn phase_failed(
&self,
scene_node_id: SceneNodeId,
name: &str,
labels: &str,
error: &str,
)
fn phase_failed( &self, scene_node_id: SceneNodeId, name: &str, labels: &str, error: &str, )
scene_node_id keys the node to flip (see
Self::phase_starting).Source§fn phase_progress(&self, update: &PhaseProgressUpdate)
fn phase_progress(&self, update: &PhaseProgressUpdate)
Source§fn op_starting(&self, parent_phase: SceneNodeId, op_name: &str)
fn op_starting(&self, parent_phase: SceneNodeId, op_name: &str)
readout: visible,
enabled by the readout wrapper). Nests under parent_phase in the
hierarchic status view; the consumer assigns its sequence within the
phase from arrival order. Default no-op so observers that don’t render
op-level leaves (and the zero-cost non-readout path) are unaffected.Source§fn op_completed(
&self,
parent_phase: SceneNodeId,
op_name: &str,
duration_secs: f64,
)
fn op_completed( &self, parent_phase: SceneNodeId, op_name: &str, duration_secs: f64, )
duration_secs is the op’s own
cumulative execution time. Default no-op.Source§fn op_failed(&self, parent_phase: SceneNodeId, op_name: &str, error: &str)
fn op_failed(&self, parent_phase: SceneNodeId, op_name: &str, error: &str)
Source§fn phase_render_attach(&self, handle: PhaseRenderHandle)
fn phase_render_attach(&self, handle: PhaseRenderHandle)
PhaseRenderHandle to the live
display fold, once, after the activity’s metrics/binder exist
(the executor calls this on-task at progress-setup time). Observers
that own a run-state actor (TUI / log-only) route it to an
AttachPhaseRender mutation so the consumer can fold active_phases
and re-derive each phase’s status line itself; the no-op default is
correct for surfaces with no live status fold (Stderr / Headless).Source§fn run_finished(&self)
fn run_finished(&self)
Source§fn log(&self, level: LogLevel, message: &str)
fn log(&self, level: LogLevel, message: &str)
eprintln! in the
runtime should go through this instead.Source§fn suppresses_stderr(&self) -> bool
fn suppresses_stderr(&self) -> bool
Source§fn live_suppress_flag(&self) -> Option<Arc<AtomicBool>>
fn live_suppress_flag(&self) -> Option<Arc<AtomicBool>>
Self::suppresses_stderr
that the runner threads into long-lived components
(e.g. the activity’s inline status thread) so they can
react to dismissal mid-run rather than honoring a
snapshot taken at construction. When None, the
activity uses a fresh AtomicBool(false) (never
suppress). Implementations that go through a TUI
(and only those) typically expose their internal
“tui_active” flag here.Source§fn reporters(&self) -> Vec<(Duration, Box<dyn Reporter>)>
fn reporters(&self) -> Vec<(Duration, Box<dyn Reporter>)>
(interval, reporter) entry is
registered with the scheduler at that interval. The default
implementation returns whatever [reporter] produced at the
base 1s cadence, so existing observers work unchanged.Source§fn cadences(&self) -> Option<Cadences>
fn cadences(&self) -> Option<Cadences>
Source§fn on_metrics_query(&self, query: Arc<MetricsQuery>)
fn on_metrics_query(&self, query: Arc<MetricsQuery>)
nmbrs_metrics::metrics_query::MetricsQuery. Observers that
render metrics (TUI, CLI status) capture this handle to read
cadence windows, now values, and session-lifetime aggregates.Auto Trait Implementations§
impl !Freeze for LogOnlyObserver
impl !RefUnwindSafe for LogOnlyObserver
impl !UnwindSafe for LogOnlyObserver
impl Forget for LogOnlyObserver
impl Move for LogOnlyObserver
impl Send for LogOnlyObserver
impl Sync for LogOnlyObserver
impl Unpin for LogOnlyObserver
impl UnsafeUnpin for LogOnlyObserver
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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