aboutsummaryrefslogtreecommitdiff
path: root/bbot/diagnostics.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-05-12 16:30:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-05-12 16:30:45 +0200
commitb0ef18751e233302faabaf64ac0e01f08ff3ac10 (patch)
treeedf0653516681def1e586081f70bcc2f63fe060d /bbot/diagnostics.hxx
parent73546642ff887b0a887d00ac43395afde99577b3 (diff)
Add support for including data with trace object
Diffstat (limited to 'bbot/diagnostics.hxx')
-rw-r--r--bbot/diagnostics.hxx22
1 files changed, 14 insertions, 8 deletions
diff --git a/bbot/diagnostics.hxx b/bbot/diagnostics.hxx
index 36a3cf2..696a912 100644
--- a/bbot/diagnostics.hxx
+++ b/bbot/diagnostics.hxx
@@ -49,8 +49,8 @@ namespace bbot
struct simple_prologue_base
{
explicit
- simple_prologue_base (const char* type, const char* name)
- : type_ (type), name_ (name) {}
+ simple_prologue_base (const char* type, const char* name, const char* data)
+ : type_ (type), name_ (name), data_ (data) {}
void
operator() (const diag_record& r) const;
@@ -58,17 +58,23 @@ namespace bbot
private:
const char* type_;
const char* name_;
+ const char* data_;
};
struct basic_mark_base
{
using simple_prologue = butl::diag_prologue<simple_prologue_base>;
+ // If data if not NULL, then we print it as (data) after name. For
+ // example:
+ //
+ // trace: main(foo): bar
+ //
explicit
basic_mark_base (const char* type,
const char* indent = "\n ",
const char* name = nullptr,
- const void* data = nullptr,
+ const char* data = nullptr,
diag_epilogue* epilogue = nullptr)
: type_ (type), name_ (name), data_ (data),
indent_ (indent), epilogue_ (epilogue) {}
@@ -76,13 +82,13 @@ namespace bbot
simple_prologue
operator() () const
{
- return simple_prologue (indent_, epilogue_, type_, name_);
+ return simple_prologue (indent_, epilogue_, type_, name_, data_);
}
public:
const char* type_;
const char* name_;
- const void* data_;
+ const char* data_;
const char* indent_;
diag_epilogue* const epilogue_;
@@ -102,7 +108,7 @@ namespace bbot
struct trace_mark_base: basic_mark_base
{
explicit
- trace_mark_base (const char* name, const void* data = nullptr);
+ trace_mark_base (const char* name, const char* data = nullptr);
};
using trace_mark = butl::diag_mark<trace_mark_base>;
@@ -119,7 +125,7 @@ namespace bbot
explicit
fail_mark_base (const char* type,
const char* indent = "\n ",
- const void* data = nullptr)
+ const char* data = nullptr)
: basic_mark_base (type,
indent,
nullptr,
@@ -136,7 +142,7 @@ namespace bbot
operator() (bool hard = true) const
{
if (hard)
- return simple_prologue (indent_, epilogue_, type_, name_);
+ return simple_prologue (indent_, epilogue_, type_, name_, data_);
simple_prologue r (error ());
r.epilogue = epilogue_;