diff --git a/src/lib.rs b/src/lib.rs index 676b3e7..c29517e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,6 +14,15 @@ macro_rules! function_name { }}; } +/// Only get the function name itself, not the full qualifier +#[macro_export] +macro_rules! function_name_short { + () => {{ + let name = function_name!(); + name.split("::").last().unwrap() + }}; +} + /// Like [`println!`] but also prints the current function name (including module path) and line. /// /// # Examples