diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-10-27 09:49:13 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-10-27 09:49:13 +0200 |
commit | 9f90ce8de8865bd111191bf6fd7434ef6d3b75ab (patch) | |
tree | 18bf1eec2b89b1f9d0229f8be20db2cb5c56d850 /libbutl/diagnostics.cxx | |
parent | b7f32cea30174e391027fecc9d431ca16b2f87c2 (diff) |
Add ability to use custom writer when flushing diag_record
Diffstat (limited to 'libbutl/diagnostics.cxx')
-rw-r--r-- | libbutl/diagnostics.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
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. } } } |