aboutsummaryrefslogtreecommitdiff
path: root/libbutl/diagnostics.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-10-27 09:49:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-10-27 09:49:13 +0200
commit9f90ce8de8865bd111191bf6fd7434ef6d3b75ab (patch)
tree18bf1eec2b89b1f9d0229f8be20db2cb5c56d850 /libbutl/diagnostics.cxx
parentb7f32cea30174e391027fecc9d431ca16b2f87c2 (diff)
Add ability to use custom writer when flushing diag_record
Diffstat (limited to 'libbutl/diagnostics.cxx')
-rw-r--r--libbutl/diagnostics.cxx10
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.
}
}
}