Multiple improvements in debugging helpers

Add variadic style macro helpers that make debugging code disappear completely
  (also the paramethers evaluation) when debugging level is lower
Chained style << is now atomic like variadic style, still can't benefit
  of paramethers eveluation stripping
Reduced to minimum the difference between Android and other platform
  debugging code
Port debugging code to new helpers, expecially a few corner cases to
  test it, and as examples of how to use it.
This commit is contained in:
Gioacchino Mazzurco 2020-06-01 00:43:44 +02:00
parent 5f06651e54
commit aef87fb1f8
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
11 changed files with 365 additions and 205 deletions

View file

@ -467,18 +467,18 @@ void JsonApiServer::registerHandler(
const std::function<void (const std::shared_ptr<rb::Session>)>& callback )
{
/* Declare outside the lambda to avoid returning a dangling
* reference on Android */
* reference */
RsWarn tWarn;
const auto authFail =
[&](int status) -> RsWarn::stream_type&
[&](int status) -> std::ostream&
{
/* Capture session by reference as it is cheaper then copying
* shared_ptr by value which is not needed in this case */
session->close(status, corsOptionsHeaders);
return tWarn << "JsonApiServer authentication handler "
"blocked an attempt to call JSON API "
"authenticated method: " << path;
"blocked an attempt to call JSON API "
"authenticated method: " << path;
};
if(session->get_request()->get_method() == "OPTIONS")