diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2019-10-20 10:38:13 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-02-10 11:57:37 +0000 |
commit | 8ebcb7a99d7b73a1ee5874780b4efdc69d32c82f (patch) | |
tree | f8f70ca32bf025dce498f88d1ec904790e0f86f4 /src/plugins/ikev2/ikev2_cli.c | |
parent | 14b804898a5e5b9ec5029d3466621178b85af925 (diff) |
ikev2: better logging
Type: refactor
Change-Id: Iedcb24684c54f4d78583ab3aa3db1097e73df248
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/plugins/ikev2/ikev2_cli.c')
-rw-r--r-- | src/plugins/ikev2/ikev2_cli.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/plugins/ikev2/ikev2_cli.c b/src/plugins/ikev2/ikev2_cli.c index 0933667c4bd..2ca1a5ccfc6 100644 --- a/src/plugins/ikev2/ikev2_cli.c +++ b/src/plugins/ikev2/ikev2_cli.c @@ -589,6 +589,42 @@ ikev2_cli_reference (void) { } +static clib_error_t * +ikev2_set_log_level_command_fn (vlib_main_t * vm, + unformat_input_t * input, + vlib_cli_command_t * cmd) +{ + unformat_input_t _line_input, *line_input = &_line_input; + u8 log_level = IKEV2_LOG_NONE; + clib_error_t *error = 0; + + /* Get a line of input. */ + if (!unformat_user (input, unformat_line_input, line_input)) + return 0; + + if (!unformat (line_input, "%d", &log_level)) + { + error = clib_error_return (0, "unknown input '%U'", + format_unformat_error, line_input); + goto done; + } + int rc = ikev2_set_log_level (log_level); + if (rc < 0) + error = clib_error_return (0, "setting log level failed!"); + +done: + unformat_free (line_input); + return error; +} + +/* *INDENT-OFF* */ +VLIB_CLI_COMMAND (ikev2_set_log_level_command, static) = { + .path = "ikev2 set logging level", + .function = ikev2_set_log_level_command_fn, + .short_help = "ikev2 set logging level <0-5>", +}; +/* *INDENT-ON* */ + /* * fd.io coding-style-patch-verification: ON * |