]> granicus.if.org Git - icinga2/commitdiff
Add console logger for nscp_api debug mode 6400/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Tue, 19 Jun 2018 10:46:10 +0000 (12:46 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Thu, 21 Jun 2018 13:08:44 +0000 (15:08 +0200)
plugins/check_nscp_api.cpp

index b0871713ded5085dd424bb8fdcc2b7b97d217da3..1fd12209ef69304d89dbb750ec4ffca40a0b6eef 100644 (file)
@@ -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 <boost/program_options.hpp>
 #include <boost/algorithm/string/split.hpp>
@@ -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<std::string>();
        if (!vm.count("arguments"))