Add proper logging

This commit is contained in:
Rodolphe Breard 2018-12-29 21:03:33 +01:00
parent 2fecbedfa1
commit c25dfb253a
4 changed files with 25 additions and 11 deletions

View file

@ -1,4 +1,5 @@
use crate::entry::Entry;
use std::fmt;
pub struct Error {
message: String,
@ -10,9 +11,11 @@ impl Error {
message: msg.to_string(),
}
}
}
pub fn display(&self) {
eprintln!("Error: {}", self.message);
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.message)
}
}