print warning message if backtrace capture is enabled

- helps to capture sudden performance issues
This commit is contained in:
Dmitry Stepanov
2026-03-02 15:29:46 +03:00
parent 737a40f8b7
commit 7d6b5654d6
+9 -2
View File
@@ -22,10 +22,10 @@
use crate::{
asset::state::LoadError,
core::{dyntype::DynTypeError, pool::PoolError, visitor::error::VisitError},
core::{dyntype::DynTypeError, pool::PoolError, visitor::error::VisitError, warn},
graphics::error::FrameworkError,
scene::graph::GraphError,
};
use fyrox_graphics::error::FrameworkError;
use std::{
backtrace::Backtrace,
fmt::{Debug, Display, Formatter},
@@ -38,6 +38,13 @@ static CAPTURE_BACKTRACE: AtomicBool = AtomicBool::new(false);
/// operation, so it is disabled by default.
pub fn enable_backtrace_capture(capture: bool) {
CAPTURE_BACKTRACE.store(capture, Ordering::Relaxed);
if capture {
warn!(
"Backtrace capture is enabled! This will negatively impact performance in \
case of error spam."
)
}
}
/// Returns `true` when the backtrace capture is one, `false` - otherwise.