diff options
author | Dave Wallace <dwallacelf@gmail.com> | 2018-02-22 16:22:09 -0500 |
---|---|---|
committer | Keith Burns <alagalah@gmail.com> | 2018-02-23 19:29:12 +0000 |
commit | 69d011915812561288e7055ed07ea6e83cecfe3b (patch) | |
tree | 87ab100389ce958f4f0b91eb234fadce61db5c26 /src/vcl/ldp.c | |
parent | a0cc5ab6d4873164bcb6cdae02b928e49553d13a (diff) |
VCL/LDP: Suppress trace output unless debug is enabled.
Change-Id: Iaef2fe4b8c6b57d54ef6309423c9a0acba8a2f89
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'src/vcl/ldp.c')
-rw-r--r-- | src/vcl/ldp.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c index 1cf2445f4fc..e7a80cb7a24 100644 --- a/src/vcl/ldp.c +++ b/src/vcl/ldp.c @@ -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 ()); } |