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:
Arne Welzel 2023-03-21 21:33:28 +01:00
parent c18366eacf
commit 2f93592c6f
2 changed files with 26 additions and 0 deletions

View file

@ -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)