diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-11-08 10:57:29 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-11-08 10:57:29 +0200 |
commit | 970e678f8a2266088f8610a2057111d211b943c1 (patch) | |
tree | b62f99b8b5c6c5210e5f1dab5477af27820b76e9 /libbutl/diagnostics.hxx | |
parent | 983bdf3dd434fd60dfdfa0fe1fda5761b57b4519 (diff) |
Pass writer to diagnostics epilogue
Diffstat (limited to 'libbutl/diagnostics.hxx')
-rw-r--r-- | libbutl/diagnostics.hxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libbutl/diagnostics.hxx b/libbutl/diagnostics.hxx index 574695c..d805c20 100644 --- a/libbutl/diagnostics.hxx +++ b/libbutl/diagnostics.hxx @@ -95,7 +95,8 @@ namespace butl template <typename> struct diag_prologue; template <typename> struct diag_mark; - using diag_epilogue = void (const diag_record&); + using diag_writer = void (const diag_record&); + using diag_epilogue = void (const diag_record&, diag_writer*); struct LIBBUTL_SYMEXPORT diag_record { @@ -131,10 +132,8 @@ namespace butl bool full () const {return !empty_;} - // Note that currently the passed writer is not passed to the epilogue. - // void - flush (void (*writer) (const diag_record&) = nullptr) const; + flush (diag_writer* = nullptr) const; void append (const char* indent, diag_epilogue* e) const @@ -185,7 +184,7 @@ namespace butl // Diagnostics writer. The default implementation writes the record text // to diag_stream. If it is NULL, then the record text is ignored. // - static void (*writer) (const diag_record&); + static diag_writer* writer; protected: #ifdef __cpp_lib_uncaught_exceptions @@ -320,10 +319,10 @@ namespace butl stack (prev_); } - // Normally passed as an epilogue. + // Normally passed as an epilogue. Writer is not used. // static void - apply (const diag_record& r) + apply (const diag_record& r, diag_writer* = nullptr) { for (const diag_frame* f (stack ()); f != nullptr; f = f->prev_) f->func_ (*f, r); |