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