pub fn with_logging_enabled<F, R>(f: F) -> Rwhere F: FnOnce() -> R,
Run a closure with logging enabled, then restore previous state.
Useful for tests that need to capture log output.