mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
logging: Better error messages for invalid Log::delay() calls
Add a test for Log::delay() usage within filter policy hooks, too.
This commit is contained in:
parent
5e046eee58
commit
e2ce929fa4
6 changed files with 29 additions and 7 deletions
|
@ -1190,12 +1190,13 @@ bool Manager::WriteToFilters(const Manager::Stream* stream, zeek::RecordValPtr c
|
|||
|
||||
ValPtr Manager::Delay(const EnumValPtr& id, const RecordValPtr record, FuncPtr post_delay_cb) {
|
||||
if ( active_writes.size() == 0 ) {
|
||||
reporter->Error("invalid Log::delay() call: no active write context available");
|
||||
reporter->Error("invalid Log::delay() call: outside of Log::log_stream_policy() hook");
|
||||
return make_intrusive<detail::LogDelayTokenVal>();
|
||||
}
|
||||
|
||||
const auto& active_write_ctx = active_writes.back();
|
||||
if ( active_write_ctx.id != id || active_write_ctx.record != record ) {
|
||||
reporter->Error("invalid Log::delay() call: active write mismatch");
|
||||
reporter->Error("invalid Log::delay() call: argument mismatch with active Log::write()");
|
||||
return make_intrusive<detail::LogDelayTokenVal>();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue