mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00

The hook being added is: bool HookReporter(const std::string& prefix, const EventHandlerPtr event, const Connection* conn, const val_list* addl, bool location, const Location* location1, const Location* location2, bool time, const std::string& buffer) override; This hook gives access to basically all information that is available in the function in Reporter.cc that performs the logging. The hook is called each time when anything passes through the reporter in the cases in which an event usually would be called. This includes weirds. The hook can return false to prevent the normal reporter events from being raised.
24 lines
820 B
Text
24 lines
820 B
Text
# @TEST-EXEC: ${DIST}/aux/bro-aux/plugin-support/init-plugin -u . Reporter Hook
|
|
# @TEST-EXEC: cp -r %DIR/reporter-hook-plugin/* .
|
|
# @TEST-EXEC: ./configure --bro-dist=${DIST} && make
|
|
# @TEST-EXEC: BRO_PLUGIN_ACTIVATE="Reporter::Hook" BRO_PLUGIN_PATH=`pwd` bro -b %INPUT 2>&1 | $SCRIPTS/diff-remove-abspath | sort | uniq >output
|
|
# @TEST-EXEC: btest-diff output
|
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER="$SCRIPTS/diff-remove-abspath | $SCRIPTS/diff-remove-timestamps" btest-diff reporter.log
|
|
|
|
@load base/frameworks/reporter
|
|
|
|
type TestType: record {
|
|
a: bool &optional;
|
|
};
|
|
|
|
event bro_init()
|
|
{
|
|
Reporter::info("Some Info");
|
|
Reporter::warning("A warning");
|
|
Reporter::error("An Error");
|
|
Reporter::error("An Error that does not show up in the log");
|
|
|
|
# And just trigger a runtime problem.
|
|
local b = TestType();
|
|
print b$a;
|
|
}
|