From 9f90ce8de8865bd111191bf6fd7434ef6d3b75ab Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 27 Oct 2022 09:49:13 +0200 Subject: Add ability to use custom writer when flushing diag_record --- libbutl/diagnostics.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libbutl/diagnostics.cxx') diff --git a/libbutl/diagnostics.cxx b/libbutl/diagnostics.cxx index f574fd6..3254e27 100644 --- a/libbutl/diagnostics.cxx +++ b/libbutl/diagnostics.cxx @@ -157,14 +157,14 @@ namespace butl void (*diag_record::writer) (const diag_record&) = &default_writer; void diag_record:: - flush () const + flush (void (*w) (const diag_record&)) const { if (!empty_) { if (epilogue_ == nullptr) { - if (writer != nullptr) - writer (*this); + if (w != nullptr || (w = writer) != nullptr) + w (*this); empty_ = true; } @@ -174,8 +174,8 @@ namespace butl // auto e (epilogue_); epilogue_ = nullptr; - e (*this); // Can throw. - flush (); // Call ourselves to write the data in case it returns. + e (*this); // Can throw. @@ TODO: pass writer. + flush (w); // Call ourselves to write the data in case it returns. } } } -- cgit v1.1