Skip to main content

Mountain/Binary/Build/PostHogPlugin/
CaptureAllowed.rs

1
2//! Capture gate. Combines the compile-time `debug_assertions` check with
3//! the master telemetry kill switch (`Capture`) and the per-pipe
4//! `Report` toggle, both baked at build time. Cheap early-exit consulted
5//! by every PostHog capture path.
6//!
7//! Pair: the OTLP pipe in `IPC::DevLog::EmitOTLPSpan` runs the same
8//! `Capture` master + its own `OTLPEnabled` toggle. The `Capture` knob
9//! is distinct from `.env.Land.Diagnostics`'s `Disable`, which kills
10//! polyfills/shims (not telemetry).
11
12use crate::Binary::Build::PostHogPlugin::Constants;
13
14pub fn Fn() -> bool {
15	if !cfg!(debug_assertions) {
16		return false;
17	}
18
19	if matches!(Constants::TELEMETRY_CAPTURE, "false" | "0" | "off") {
20		return false;
21	}
22
23	!matches!(Constants::POSTHOG_ENABLED, "false" | "0" | "off")
24}