diff --git a/src/error_injection.rs b/src/error_injection.rs index 0f6ef7fafcfc8f0e1abd207ed09c99c1cbb3ad16..8cc3a6a8eedb554f4bb242b760d45ceefd0ce9ba 100644 --- a/src/error_injection.rs +++ b/src/error_injection.rs @@ -1,3 +1,4 @@ +use crate::tlog; use std::collections::HashSet; static mut INJECTED_ERRORS: Option<HashSet<String>> = None; @@ -9,7 +10,9 @@ pub fn enable(error: &str, enable: bool) { let injected_errors = injected_errors.get_or_insert_with(Default::default); if enable { injected_errors.insert(error.into()); + tlog!(Info, "ERROR INJECTION '{error}': fused"); } else { + tlog!(Info, "ERROR INJECTION '{error}': defused"); injected_errors.remove(error); } } @@ -38,7 +41,7 @@ macro_rules! error_injection { #[rustfmt::skip] if $crate::error_injection::is_enabled($error) { $crate::tlog!(Info, "################################################################"); - $crate::tlog!(Info, "ERROR INJECTED '{}': EXITING", $error); + $crate::tlog!(Info, "ERROR INJECTION '{}': EXITING", $error); $crate::tlog!(Info, "################################################################"); $crate::tarantool::exit(69); }; @@ -48,7 +51,7 @@ macro_rules! error_injection { #[rustfmt::skip] if $crate::error_injection::is_enabled(error) { $crate::tlog!(Info, "################################################################"); - $crate::tlog!(Info, "ERROR INJECTED '{}': BLOCKING", error); + $crate::tlog!(Info, "ERROR INJECTION '{}': BLOCKING", error); $crate::tlog!(Info, "################################################################"); while $crate::error_injection::is_enabled(error) { @@ -56,7 +59,7 @@ macro_rules! error_injection { } $crate::tlog!(Info, "################################################################"); - $crate::tlog!(Info, "ERROR UNINJECTED '{}': UNBLOCKING", error); + $crate::tlog!(Info, "ERROR INJECTION '{}': UNBLOCKING", error); $crate::tlog!(Info, "################################################################"); }; }}; diff --git a/src/luamod.rs b/src/luamod.rs index 1e798d32363fa7d0c2ee0eff2fb889ccfed2d46f..f8c577654cbbd2ce3c3885f0291211d11ae735bf 100644 --- a/src/luamod.rs +++ b/src/luamod.rs @@ -1462,8 +1462,11 @@ pub(crate) fn setup(args: &args::Run) { 1. error (string) 2. enable (bool) "}, - tlua::Function::new(|error: String, enable: bool| { - crate::error_injection::enable(&error, enable); - }), + { + tlog!(Info, "error injection enabled"); + tlua::Function::new(|error: String, enable: bool| { + crate::error_injection::enable(&error, enable); + }) + }, ); }