Merge branch 'topic/amazingpp/broker-debug-output-truncated' of ssh://github.com/AmazingPP/zeek

* 'topic/amazingpp/broker-debug-output-truncated' of ssh://github.com/AmazingPP/zeek:
  Use json_escape_utf8 in broker debug output
This commit is contained in:
Robin Sommer 2022-10-26 11:37:24 +02:00
commit 2959afba8a
No known key found for this signature in database
GPG key ID: D8187293B3FFE5D0
3 changed files with 12 additions and 8 deletions

View file

@ -1,3 +1,7 @@
5.2.0-dev.147 | 2022-10-26 11:37:24 +0200
* GH-2272: Use `json_escape_utf8` in broker debug output (AmazingPP)
5.2.0-dev.145 | 2022-10-26 10:51:05 +0200 5.2.0-dev.145 | 2022-10-26 10:51:05 +0200
* Reintroduce event groups. (Arne Welzel, Corelight) * Reintroduce event groups. (Arne Welzel, Corelight)

View file

@ -1 +1 @@
5.2.0-dev.145 5.2.0-dev.147

View file

@ -189,14 +189,19 @@ struct scoped_reporter_location
}; };
#ifdef DEBUG #ifdef DEBUG
static std::string RenderMessage(const broker::data& d)
{
return util::json_escape_utf8(broker::to_string(d));
}
static std::string RenderMessage(std::string topic, const broker::data& x) static std::string RenderMessage(std::string topic, const broker::data& x)
{ {
return util::fmt("%s -> %s", broker::to_string(x).c_str(), topic.c_str()); return util::fmt("%s -> %s", RenderMessage(x).c_str(), topic.c_str());
} }
static std::string RenderEvent(std::string topic, std::string name, const broker::data& args) static std::string RenderEvent(std::string topic, std::string name, const broker::data& args)
{ {
return util::fmt("%s(%s) -> %s", name.c_str(), broker::to_string(args).c_str(), topic.c_str()); return util::fmt("%s(%s) -> %s", name.c_str(), RenderMessage(args).c_str(), topic.c_str());
} }
static std::string RenderMessage(const broker::store::response& x) static std::string RenderMessage(const broker::store::response& x)
@ -210,11 +215,6 @@ static std::string RenderMessage(const broker::vector* xs)
return broker::to_string(*xs); return broker::to_string(*xs);
} }
static std::string RenderMessage(const broker::data& d)
{
return broker::to_string(d);
}
static std::string RenderMessage(const broker::vector& xs) static std::string RenderMessage(const broker::vector& xs)
{ {
return broker::to_string(xs); return broker::to_string(xs);