From d9a55ac064ba15d2250cbbfb6d20f57595f554f1 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 19 Jun 2018 12:46:10 +0200 Subject: [PATCH] Add console logger for nscp_api debug mode --- plugins/check_nscp_api.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/check_nscp_api.cpp b/plugins/check_nscp_api.cpp index b0871713d..1fd12209e 100644 --- a/plugins/check_nscp_api.cpp +++ b/plugins/check_nscp_api.cpp @@ -25,6 +25,7 @@ #include "base/application.hpp" #include "base/json.hpp" #include "base/string.hpp" +#include "base/logger.hpp" #include "base/exception.hpp" #include #include @@ -284,6 +285,12 @@ int main(int argc, char **argv) l_Debug = vm.count("debug") > 0; + // Initialize logger + if (l_Debug) + Logger::SetConsoleLogSeverity(LogDebug); + else + Logger::SetConsoleLogSeverity(LogWarning); + // Create the URL string and escape certain characters since Url() follows RFC 3986 String endpoint = "/query/" + vm["query"].as(); if (!vm.count("arguments"))