Reporter: Add ScriptLocationScope helper

This commit is contained in:
Arne Welzel 2024-11-26 11:46:43 +01:00
parent c7c96610e3
commit 27e6d87331
2 changed files with 23 additions and 1 deletions

View file

@ -14,6 +14,7 @@
#include "zeek/Event.h"
#include "zeek/EventHandler.h"
#include "zeek/Expr.h"
#include "zeek/Frame.h"
#include "zeek/ID.h"
#include "zeek/NetVar.h"
#include "zeek/RunState.h"
@ -649,4 +650,10 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Conne
bool Reporter::EmitToStderr(bool flag) { return flag || ! run_state::detail::zeek_init_done; }
ScriptLocationScope::ScriptLocationScope(const zeek::detail::Frame* frame) {
zeek::reporter->PushLocation(frame->GetCallLocation());
}
ScriptLocationScope::~ScriptLocationScope() { zeek::reporter->PopLocation(); }
} // namespace zeek