Add messages for different verbosity levels.

Output copy actions
This commit is contained in:
O01eg 2019-03-20 12:50:18 +03:00
parent 3eb4890dfe
commit b6e5d7348a
No known key found for this signature in database
GPG key ID: 8FBA74B3E78B4677

View file

@ -726,6 +726,17 @@ impl Build {
}
}
pub fn is_verbose_than(&self, level: usize) -> bool {
self.verbosity > level
}
/// Prints a message if this build is configured in more verbose mode than `level`.
fn verbose_than(&self, level: usize, msg: &str) {
if self.is_verbose_than(level) {
println!("{}", msg);
}
}
fn info(&self, msg: &str) {
if self.config.dry_run { return; }
println!("{}", msg);
@ -1158,6 +1169,7 @@ impl Build {
/// Copies a file from `src` to `dst`
pub fn copy(&self, src: &Path, dst: &Path) {
if self.config.dry_run { return; }
self.verbose_than(1, &format!("Copy {:?} to {:?}", src, dst));
let _ = fs::remove_file(&dst);
let metadata = t!(src.symlink_metadata());
if metadata.file_type().is_symlink() {