Skip to content

Commit e33b9ff

Browse files
MichaelGruppntjohnson1
authored andcommitted
Consider RERUN_PANIC_ON_WARN in rerun_c's debug-mode warning (#11961)
Fixes failing snippet tests in main CI.
1 parent 67bf231 commit e33b9ff

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

crates/top/rerun_c/src/lib.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,19 @@ fn rr_recording_stream_new_impl(
539539
re_log::setup_logging();
540540
if cfg!(debug_assertions) {
541541
re_crash_handler::install_crash_handlers(re_build_info::build_info!());
542-
re_log::warn!("Using a DEBUG BUILD of the Rerun SDK with Rerun crash handlers!");
542+
543+
// Log a clear warning to inform users that (accidentally) use a debug build of the SDK.
544+
// This should however _never_ cause a panic if RERUN_PANIC_ON_WARN is set, e.g. in test environments.
545+
const DEBUG_BUILD_WARNING: &str =
546+
"Using a DEBUG BUILD of the Rerun SDK with Rerun crash handlers!";
547+
let can_log_warning = std::env::var("RERUN_PANIC_ON_WARN")
548+
.map(|value| value == "0")
549+
.unwrap_or(true);
550+
if can_log_warning {
551+
re_log::warn!(DEBUG_BUILD_WARNING);
552+
} else {
553+
re_log::info!(DEBUG_BUILD_WARNING);
554+
}
543555
}
544556
});
545557
}

0 commit comments

Comments
 (0)