VCL/LDP: Suppress trace output unless debug is enabled. 66/10766/2
authorDave Wallace <dwallacelf@gmail.com>
Thu, 22 Feb 2018 21:22:09 +0000 (16:22 -0500)
committerKeith Burns <alagalah@gmail.com>
Fri, 23 Feb 2018 19:29:12 +0000 (19:29 +0000)
Change-Id: Iaef2fe4b8c6b57d54ef6309423c9a0acba8a2f89
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
src/vcl/ldp.c
src/vcl/vppcom.c

index 1cf2445..e7a80cb 100644 (file)
@@ -144,9 +144,10 @@ ldp_init (void)
              else
                {
                  ldp->debug = tmp;
-                 clib_warning ("LDP<%d>: configured LDP debug level (%u) "
-                               "from the env var " LDP_ENV_DEBUG "!",
-                               getpid (), ldp->debug);
+                 if (LDP_DEBUG > 0)
+                   clib_warning ("LDP<%d>: configured LDP debug level (%u) "
+                                 "from the env var " LDP_ENV_DEBUG "!",
+                                 getpid (), ldp->debug);
                }
            }
 
@@ -154,9 +155,10 @@ ldp_init (void)
          if (env_var_str)
            {
              ldp_set_app_name (env_var_str);
-             clib_warning ("LDP<%d>: configured LDP app name (%s) "
-                           "from the env var " LDP_ENV_APP_NAME "!",
-                           getpid (), ldp->app_name);
+             if (LDP_DEBUG > 0)
+               clib_warning ("LDP<%d>: configured LDP app name (%s) "
+                             "from the env var " LDP_ENV_APP_NAME "!",
+                             getpid (), ldp->app_name);
            }
 
          env_var_str = getenv (LDP_ENV_SID_BIT);
@@ -203,15 +205,17 @@ ldp_init (void)
                  ldp->sid_bit_val = (1 << sb);
                  ldp->sid_bit_mask = ldp->sid_bit_val - 1;
 
-                 clib_warning ("LDP<%d>: configured LDP sid bit (%u) "
-                               "from " LDP_ENV_SID_BIT
-                               "!  sid bit value %d (0x%x)", getpid (),
-                               sb, ldp->sid_bit_val, ldp->sid_bit_val);
+                 if (LDP_DEBUG > 0)
+                   clib_warning ("LDP<%d>: configured LDP sid bit (%u) "
+                                 "from " LDP_ENV_SID_BIT
+                                 "!  sid bit value %d (0x%x)", getpid (),
+                                 sb, ldp->sid_bit_val, ldp->sid_bit_val);
                }
            }
 
          clib_time_init (&ldp->clib_time);
-         clib_warning ("LDP<%d>: LDP initialization: done!", getpid ());
+         if (LDP_DEBUG > 0)
+           clib_warning ("LDP<%d>: LDP initialization: done!", getpid ());
        }
       else
        {
@@ -3413,7 +3417,7 @@ ldp_constructor (void)
   if (ldp_init () != 0)
     fprintf (stderr, "\nLDP<%d>: ERROR: ldp_constructor: failed!\n",
             getpid ());
-  else
+  else if (LDP_DEBUG > 0)
     clib_warning ("LDP<%d>: LDP constructor: done!\n", getpid ());
 }
 
@@ -3433,8 +3437,9 @@ ldp_destructor (void)
   /* Don't use clib_warning() here because that calls writev()
    * which will call ldp_init().
    */
-  printf ("%s:%d: LDP<%d>: LDP destructor: done!\n",
-         __func__, __LINE__, getpid ());
+  if (LDP_DEBUG > 0)
+    printf ("%s:%d: LDP<%d>: LDP destructor: done!\n",
+           __func__, __LINE__, getpid ());
 }
 
 
index 4b3581a..c7cd1e9 100644 (file)
@@ -856,7 +856,8 @@ vl_api_unmap_segment_t_handler (vl_api_unmap_segment_t * mp)
  * XXX Need segment_name to session_id hash,
  * XXX - have sessionID by handle hash currently
  */
-  clib_warning ("Unmapped segment '%s'", mp->segment_name);
+  if (VPPCOM_DEBUG > 1)
+    clib_warning ("Unmapped segment '%s'", mp->segment_name);
 }
 
 static void
@@ -2172,15 +2173,15 @@ vppcom_app_create (char *app_name)
        {
          u32 tmp;
          if (sscanf (env_var_str, "%u", &tmp) != 1)
-           clib_warning ("VCL<%d>: Invalid debug level specified in "
-                         "the environment variable "
-                         VPPCOM_ENV_DEBUG
+           clib_warning ("VCL<%d>: WARNING: Invalid debug level specified "
+                         "in the environment variable " VPPCOM_ENV_DEBUG
                          " (%s)!\n", getpid (), env_var_str);
          else
            {
              vcm->debug = tmp;
-             clib_warning ("VCL<%d>: configured VCL debug level (%u) from "
-                           VPPCOM_ENV_DEBUG "!", getpid (), vcm->debug);
+             if (VPPCOM_DEBUG > 0)
+               clib_warning ("VCL<%d>: configured VCL debug level (%u) from "
+                             VPPCOM_ENV_DEBUG "!", getpid (), vcm->debug);
            }
        }
       conf_fname = getenv (VPPCOM_ENV_CONF);
@@ -2212,8 +2213,8 @@ vppcom_app_create (char *app_name)
        {
          u64 tmp;
          if (sscanf (env_var_str, "%lu", &tmp) != 1)
-           clib_warning ("VCL<%d>: Invalid namespace secret specified in "
-                         "the environment variable "
+           clib_warning ("VCL<%d>: WARNING: Invalid namespace secret "
+                         "specified in the environment variable "
                          VPPCOM_ENV_APP_NAMESPACE_SECRET
                          " (%s)!\n", getpid (), env_var_str);
          else
@@ -2244,8 +2245,8 @@ vppcom_app_create (char *app_name)
        {
          u64 tmp;
          if (sscanf (env_var_str, "%lu", &tmp) != 1)
-           clib_warning ("VCL<%d>: Invalid namespace secret specified in "
-                         "the environment variable "
+           clib_warning ("VCL<%d>: WARNING: Invalid namespace secret "
+                         "specified in the environment variable "
                          VPPCOM_ENV_APP_NAMESPACE_SECRET
                          " (%s)!\n", getpid (), env_var_str);
          else
@@ -3950,10 +3951,10 @@ vppcom_epoll_wait (uint32_t vep_idx, struct epoll_event *events,
     }
   if (PREDICT_FALSE (vep_next_sid == ~0))
     {
-      if (VPPCOM_DEBUG > 0)
+      if (VPPCOM_DEBUG > 1)
        clib_warning ("VCL<%d>: WARNING: vep_idx (%u) is empty!",
                      getpid (), vep_idx);
-      if (VPPCOM_DEBUG > 0)
+      if (VPPCOM_DEBUG > 1)
        {
           /* *INDENT-OFF* */
          ELOG_TYPE_DECLARE (e) =