SDK Logging Controls

Controlling logging globally controlling-logging-globally

Rerun logging is enabled by default. The logging behavior can be overridden at runtime using the RERUN environment variable:

export RERUN=off
# or
cargo run my_rerun_package

# No log messages will be transmitted.

The RERUN environment variable is read once during SDK initialization. The accepted values for RERUN are 1/on/true, and 0/off/false.

ā„¹ļø Note: When Rerun is disabled, logging statements are bypassed and essentially become no-ops.

Creating a default-off setup in code creating-a-defaultoff-setup-in-code

The "default-on" behavior can also be changed to a "default-off" behavior:

import rerun as rr

rr.init("rerun_example_app", default_enabled=False)

Dynamically turn logging on/off dynamically-turn-logging-onoff

In order to dynamically turn off logging at runtime, you can swap out the active recording with a disabled recording. When you want to turn logging back on, you simply continue to use the previous recording again.

Rust rust

In Rust you always pass the recording explicitly, making this fully transparent. In order to create a no-op recording call RecordingStream::disabled().

let noop_rec = RecordingStream::disabled();

Python python

The Python API uses the global recording stream by default. To swap it out with a no-op recording call set_global_data_recording with None.

# Disabling logging
prev_rec = rr.set_global_data_recording(None)

# ā€¦

# Re-enabling logging