mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 02:58:20 +00:00
Reporter: Add dedicated Deprecation() method
Minimally, provide a way to funnel all deprecations through reporter->Deprecation() instead of various Warning() invocations.
This commit is contained in:
parent
c18366eacf
commit
2f93592c6f
2 changed files with 26 additions and 0 deletions
|
@ -59,6 +59,8 @@ Reporter::Reporter(bool arg_abort_on_scripting_errors)
|
|||
weird_sampling_duration = 0;
|
||||
weird_sampling_threshold = 0;
|
||||
|
||||
ignore_deprecations = false;
|
||||
|
||||
syslog_open = false;
|
||||
}
|
||||
|
||||
|
@ -532,6 +534,21 @@ void Reporter::Weird(const IPAddr& orig, const IPAddr& resp, const char* name, c
|
|||
"%s", name);
|
||||
}
|
||||
|
||||
void Reporter::Deprecation(std::string_view msg, const detail::Location* loc1,
|
||||
const detail::Location* loc2)
|
||||
{
|
||||
if ( ignore_deprecations )
|
||||
return;
|
||||
|
||||
if ( loc1 || loc2 )
|
||||
PushLocation(loc1, loc2);
|
||||
|
||||
Warning("%s", msg.data());
|
||||
|
||||
if ( loc1 || loc2 )
|
||||
PopLocation();
|
||||
}
|
||||
|
||||
void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Connection* conn,
|
||||
ValPList* addl, bool location, bool time, const char* postfix, const char* fmt,
|
||||
va_list ap)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue