summaryrefslogtreecommitdiff
path: root/lib/yang.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2019-10-16 16:59:54 -0300
committerRenato Westphal <renato@opensourcerouting.org>2019-10-16 17:11:41 -0300
commit62ae9adeef7cc88918b049a2e1d71086b408f032 (patch)
tree36029c12907730eb43a6a3a19dcc92200402eb56 /lib/yang.c
parent21f5aade3d4689f0f6b3d5823685fec99c35a703 (diff)
lib, vtysh: add new libyang option to the "debug northbound" command
Guard the libyang debug messages under this command so that only people interested on those messages will see them. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/yang.c')
-rw-r--r--lib/yang.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/yang.c b/lib/yang.c
index 5470762ea6..d153f75530 100644
--- a/lib/yang.c
+++ b/lib/yang.c
@@ -616,6 +616,17 @@ static void ly_log_cb(LY_LOG_LEVEL level, const char *msg, const char *path)
zlog(priority, "libyang: %s", msg);
}
+void yang_debugging_set(bool enable)
+{
+ if (enable) {
+ ly_verb(LY_LLDBG);
+ ly_verb_dbg(0xFF);
+ } else {
+ ly_verb(LY_LLERR);
+ ly_verb_dbg(0);
+ }
+}
+
struct ly_ctx *yang_ctx_new_setup(void)
{
struct ly_ctx *ctx;
@@ -645,10 +656,6 @@ void yang_init(void)
ly_set_log_clb(ly_log_cb, 1);
ly_log_options(LY_LOLOG | LY_LOSTORE);
- /* Let libyang log everything possible. */
- ly_verb(LY_LLDBG);
- ly_verb_dbg(0xFF);
-
/* Initialize libyang container for native models. */
ly_native_ctx = yang_ctx_new_setup();
if (!ly_native_ctx) {