summaryrefslogtreecommitdiff
path: root/pathd/path_pcep_cli.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-03-26 16:54:54 +0200
committerMark Stapp <mjs@cisco.com>2024-08-27 09:53:02 -0400
commit5dac6961540422a1ca139fae8c5ea9e5a437c4ba (patch)
tree3ff27afc04b9605f832c747b82449b58d5aa5455 /pathd/path_pcep_cli.c
parent1797b7eefc730bb4f5aec08f130861650c61dd97 (diff)
lib: rework debug init
The debug library allows to register a `debug_set_all` callback which should enable all debugs in a daemon. This callback is implemented exactly the same in each daemon. Instead of duplicating the code, rework the lib to allow registration of each debug type, and implement the common code only once in the lib. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'pathd/path_pcep_cli.c')
-rw-r--r--pathd/path_pcep_cli.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/pathd/path_pcep_cli.c b/pathd/path_pcep_cli.c
index 66d1aa8b4e..1e0d52e38d 100644
--- a/pathd/path_pcep_cli.c
+++ b/pathd/path_pcep_cli.c
@@ -47,7 +47,6 @@
/* CLI Function declarations */
static int pcep_cli_debug_config_write(struct vty *vty);
-static int pcep_cli_debug_set_all(uint32_t flags, bool set);
static int pcep_cli_pcep_config_write(struct vty *vty);
static int pcep_cli_pcc_config_write(struct vty *vty);
static int pcep_cli_pce_config_write(struct vty *vty);
@@ -1710,17 +1709,6 @@ int pcep_cli_debug_config_write(struct vty *vty)
return 0;
}
-int pcep_cli_debug_set_all(uint32_t flags, bool set)
-{
- DEBUG_FLAGS_SET(&pcep_g->dbg, flags, set);
-
- /* If all modes have been turned off, don't preserve options. */
- if (!DEBUG_MODE_CHECK(&pcep_g->dbg, DEBUG_MODE_ALL))
- DEBUG_CLEAR(&pcep_g->dbg);
-
- return 0;
-}
-
int pcep_cli_pcep_config_write(struct vty *vty)
{
vty_out(vty, " pcep\n");
@@ -2345,7 +2333,11 @@ void pcep_cli_init(void)
hook_register(pathd_srte_config_write, pcep_cli_pcep_config_write);
hook_register(nb_client_debug_config_write,
pcep_cli_debug_config_write);
- hook_register(nb_client_debug_set_all, pcep_cli_debug_set_all);
+
+ debug_install(&pcep_g->dbg_basic);
+ debug_install(&pcep_g->dbg_path);
+ debug_install(&pcep_g->dbg_msg);
+ debug_install(&pcep_g->dbg_lib);
memset(&pce_connections_g, 0, sizeof(pce_connections_g));