Environment variable
Use an environment variable when you want to disable tracing for the entire program without modifying application code. To unconditionally disable tracing for the entire program, set the environment variableWEAVE_DISABLED=true.
WEAVE_DISABLED is read only once, at function-definition time. You can’t use this variable to toggle tracing at runtime.
Client initialization
To conditionally disable tracing for a specific Weave client, initialize the client with thedisabled flag in init settings.
- Python
- TypeScript
Context manager
To conditionally disable tracing only within a specific block of code, use a tracing context manager. Usewith tracing_disabled() to suppress tracing only for the function calls executed inside the with block. Use it in application code to scope which calls shouldn’t be logged.
- Python
- TypeScript
- Python
- TypeScript