diff --git a/src/util_msg.rs b/src/util_msg.rs index c11d1ec..7b0e3fe 100644 --- a/src/util_msg.rs +++ b/src/util_msg.rs @@ -8,6 +8,7 @@ lazy_static! { static ref PRINT_MESSAGE_LOCK: Arc> = Arc::new(Mutex::new(())); } +#[derive(Clone, Copy)] pub enum MessageType { INFO, OK, WARN, ERROR, DEBUG, } pub fn is_atty() -> bool { @@ -59,6 +60,12 @@ pub fn print_message(mt: MessageType, message: &str) { } } +impl MessageType { + pub fn print(&self, message: &str) { + print_message(*self, message); + } +} + pub fn flush_stdout() { io::stdout().flush().ok(); }