diff options
Diffstat (limited to 'build/trace')
-rw-r--r-- | build/trace | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/build/trace b/build/trace index f1c0567..1764a69 100644 --- a/build/trace +++ b/build/trace @@ -34,9 +34,11 @@ namespace build return std::cerr << x; } + explicit record (tracer& t): empty_ (false) {t.begin ();} + explicit record (bool e = true): empty_ (e) {} + // Movable-only type. // - explicit record (bool e = true): empty_ (e) {} record (record&& r) {empty_ = r.empty_; r.empty_ = true;} record& operator= (record&& r) {empty_ = r.empty_; r.empty_ = true;} @@ -51,10 +53,17 @@ namespace build record operator<< (const T& x) const { - std::cerr << "trace: " << name_ << ": " << x; + begin (); + std::cerr << x; return record (false); } + void + begin () const + { + std::cerr << "trace: " << name_ << ": "; + } + private: const char* name_; }; |