diff --git a/thin-provisioning/thin_check.cc b/thin-provisioning/thin_check.cc index 130b141..586360c 100644 --- a/thin-provisioning/thin_check.cc +++ b/thin-provisioning/thin_check.cc @@ -43,6 +43,7 @@ namespace { : out_(out), step_(step), beginning_of_line_(true), + enabled(true), indent_(0) { } @@ -53,13 +54,18 @@ namespace { indent(); } - out_ << t; + if (enabled) + out_ << t; + return *this; } nested_output &operator <<(end_message const &m) { beginning_of_line_ = true; - out_ << endl; + + if (enabled) + out_ << endl; + return *this; } @@ -88,16 +94,26 @@ namespace { return nest(*this); } + void enable() { + enabled = true; + } + + void disable() { + enabled = false; + } + private: void indent() { - for (unsigned i = 0; i < indent_; i++) - out_ << ' '; + if (enabled) + for (unsigned i = 0; i < indent_; i++) + out_ << ' '; } ostream &out_; unsigned step_; bool beginning_of_line_; + bool enabled; unsigned indent_; }; @@ -242,6 +258,9 @@ namespace { block_manager<>::ptr bm = open_bm(path); nested_output out(cerr, 2); + if (fs.quiet) + out.disable(); + superblock_reporter sb_rep(out); devices_reporter dev_rep(out); mapping_reporter mapping_rep(out);