summaryrefslogtreecommitdiff
path: root/src/progress.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-12-08 12:12:09 +0200
committerLars Wirzenius <liw@liw.fi>2021-12-08 12:12:09 +0200
commit94bc8dc8b4537d228121f877513aafcae42cbb44 (patch)
treec5a8d68f5fc9e9814b8918d7a7f3ceabddaea685 /src/progress.rs
parent31dc6df2d478e66eb39388dedd48080da0e72645 (diff)
downloadvmadm-94bc8dc8b4537d228121f877513aafcae42cbb44.tar.gz
feat: give a more useful error message when VM image already exists
Sponsored-by: author
Diffstat (limited to 'src/progress.rs')
-rw-r--r--src/progress.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/progress.rs b/src/progress.rs
index 52ade35..5ce56af 100644
--- a/src/progress.rs
+++ b/src/progress.rs
@@ -1,5 +1,7 @@
//! Show progress, or not.
+use log::{debug, error, info};
+
#[derive(Debug, Clone, Copy)]
pub enum MessageKind {
OnlyErrors,
@@ -21,6 +23,7 @@ impl Progress {
}
pub fn chatty(&self, msg: &str) {
+ debug!("{}", msg);
if let MessageKind::Everything = self.level {
self.message("DEBUG", msg);
}
@@ -28,13 +31,17 @@ impl Progress {
pub fn step(&self, msg: &str) {
match self.level {
- MessageKind::Everything | MessageKind::Steps => self.message("INFO", msg),
+ MessageKind::Everything | MessageKind::Steps => {
+ info!("{}", msg);
+ self.message("INFO", msg)
+ }
_ => (),
}
}
pub fn error(&self, msg: &str) {
// Errors are always written out.
+ error!("{}", msg);
self.message("ERROR", msg);
}
}