cec-client: don't display debug output by default in 'cec-client -l'
authorLars Op den Kamp <lars@opdenkamp.eu>
Wed, 20 Jun 2012 09:38:27 +0000 (11:38 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Wed, 20 Jun 2012 09:38:27 +0000 (11:38 +0200)
src/testclient/main.cpp

index 94bfd28f696a2ddeee91627fa7f3a031580dcc6a..143cfdb5d8f1f9b15d9142b3e076090129b81f9e 100644 (file)
@@ -51,7 +51,8 @@ using namespace PLATFORM;
 
 ICECCallbacks        g_callbacks;
 libcec_configuration g_config;
-int                  g_cecLogLevel(CEC_LOG_ALL);
+int                  g_cecLogLevel(-1);
+int                  g_cecDefaultLogLevel(CEC_LOG_ALL);
 ofstream             g_logOutput;
 bool                 g_bShortLog(false);
 CStdString           g_strPort;
@@ -1009,6 +1010,8 @@ bool ProcessCommandLineArguments(int argc, char *argv[])
       else if (!strcmp(argv[iArgPtr], "--list-devices") ||
                !strcmp(argv[iArgPtr], "-l"))
       {
+        if (g_cecLogLevel == -1)
+          g_cecLogLevel = CEC_LOG_WARNING + CEC_LOG_ERROR;
         ICECAdapter *parser = LibCecInitialise(&g_config);
         if (parser)
         {
@@ -1032,6 +1035,9 @@ bool ProcessCommandLineArguments(int argc, char *argv[])
       else if (!strcmp(argv[iArgPtr], "--help") ||
                !strcmp(argv[iArgPtr], "-h"))
       {
+        if (g_cecLogLevel == -1)
+          g_cecLogLevel = CEC_LOG_WARNING + CEC_LOG_ERROR;
+
         ShowHelpCommandLine(argv[0]);
         return 0;
       }
@@ -1112,6 +1118,9 @@ int main (int argc, char *argv[])
   if (!ProcessCommandLineArguments(argc, argv))
     return 0;
 
+  if (g_cecLogLevel == -1)
+    g_cecLogLevel = g_cecDefaultLogLevel;
+
   if (g_config.deviceTypes.IsEmpty())
   {
     if (!g_bSingleCommand)