Expand description
Tag-filtered development logging (Trace env var). Must be declared before WindServiceHandlers so the dev_log! macro is available.
§DevLog - Tag-filtered development logging
Tag-gated logging used across Mountain. Controlled by the
Trace env var: Trace=vfs,ipc for selective tags,
Trace=all for everything, Trace=short for the
everything-but-firehose preset (path aliasing + dedupe).
Mirror to a session log file when Record=1 (or when
Trace is set in a debug build).
Layout: every public Fn/Struct lives in its own sibling
file. The two macros (dev_log!, otel_span!) live here
so #[macro_export] puts them at the crate root and the
callsite spelling stays dev_log!("ipc", "…").
Modules§
- Alias
Path - Replace the long Tauri app-data prefix with
$APPsoTrace=shortlines stay readable. - AppData
Prefix - Resolve the Tauri app-data prefix for THIS profile so logs
and aliasing pick the right
~/Library/Application Support/ land.editor.*.mountaindirectory. The detection walks the Application Support tree, prefers a strict suffix match against the binary signature, falls back to the first*.mountaincandidate so a mismatch still produces a usable path. - Debug
Once - Emit a tagged dev-log line exactly once per process, keyed
on
Key. Subsequent calls with the same key are dropped from the console; the file sink still records the first occurrence so post-mortems show every probe path that fired. - Dedup
State - Consecutive-duplicate suppression buffer used by the
dev_log!macro underTrace=short. Holds the last logged key + a repeat count; the macro flushes a(xN)tail when the key changes. - EmitOTLP
Span - Fire-and-forget OTLP span exporter. Sends a single
resourceSpanspayload over plain HTTP to the collector atOTLPEndpoint(default127.0.0.1:4318, configurable via.env.Land.PostHog). Stops trying after the first failure (OTLP_AVAILABLEflips tofalse) so a missing collector doesn’t tax every IPC call. Release builds are compiled out viacfg!(debug_assertions). Honors theCapturemaster telemetry kill switch and the per-pipeOTLPEnabledtoggle. - Flush
Dedup - Flush the consecutive-duplicate buffer - emits a
(xN)tail line if the pending count is greater than 1, then clears. - Init
Eager - Force the file sink to initialise before the first
dev_log!so a panic on the boot path still produces a header line + opt-in path. Harmless to call multiple times. - IsBenign
Enoent - Recognise known-optional probe paths so
stat ENOENTlines for them downgrade to debug-once instead of full error noise. The list is the union of: - IsEnabled
- Tag-resolution helper. Reads
Traceonce into a static list, then matches against four rules per call: - IsShort
truewhenTrace=shortis set - enables path aliasing and consecutive-duplicate compression indev_log!.- NowNano
- Wall-clock nanoseconds since UNIX epoch. Used as the start tick for OTLP spans and per-IPC latency measurements.
- Session
Timestamp - Local-time session timestamp (
%Y%m%dT%H%M%S) cached once per process. Must agree withWindServiceHandlers::nativeHost:getEnvironmentPathsso the Mountain dev log and VS Code’swindow<N>/output_*log land in the same session directory. - Write
ToFile - Append a single formatted line to the session’s
Mountain.dev.log. The file sink is lazy: opens on first call, no-ops ifRecord=0or the directory cannot be created. Flushes per line sotail -fshows live output.