Created
February 6, 2017 19:59
-
-
Save ChrisMacNaughton/017948a5c71bc0109b89a3cac2e31b0c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #[macro_export] | |
| macro_rules! log { | |
| ($message:expr) => {{ | |
| log!($message, Debug) | |
| }}; | |
| ($message:expr, $level:ident) => {{ | |
| charmhelpers::core::hookenv::log( | |
| $message.to_string(), | |
| Some(LogLevel::$level), | |
| ); | |
| }} | |
| } | |
| #[cfg(test)] | |
| mod tests { | |
| #[allow(dead_code)] | |
| mod log { | |
| use charmhelpers; | |
| use log::LogLevel; | |
| fn it_logs_default() { | |
| log!("This is a test"); | |
| } | |
| fn it_logs_specific_level() { | |
| log!("test 2", Warn); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment