This commit introduces a command to inject user-defined log messages at the info level. The primary use case is debugging, enabling annotations to be added to the log for better context.
The following is an example: ovs-appctl vlog/message "Add the following to the log..." Signed-off-by: Eelco Chaudron <[email protected]> --- v2: Fixed review comments. --- lib/vlog.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/vlog.c b/lib/vlog.c index 876209ee2..806ba1a41 100644 --- a/lib/vlog.c +++ b/lib/vlog.c @@ -826,6 +826,14 @@ vlog_disable_rate_limit(struct unixctl_conn *conn, int argc, set_rate_limits(conn, argc, argv, false); } +static void +vlog_inject_info_log(struct unixctl_conn *conn, int argc OVS_UNUSED, + const char *argv[], void *aux OVS_UNUSED) +{ + VLOG_INFO("user-message: %s", argv[1]); + unixctl_command_reply(conn, NULL); +} + /* Initializes the logging subsystem and registers its unixctl server * commands. */ void @@ -878,6 +886,8 @@ vlog_init(void) vlog_unixctl_reopen, NULL); unixctl_command_register("vlog/close", "", 0, 0, vlog_unixctl_close, NULL); + unixctl_command_register("vlog/message", NULL, 1, 1, + vlog_inject_info_log, NULL); ovs_rwlock_rdlock(&pattern_rwlock); print_syslog_target_deprecation = syslog_fd >= 0; -- 2.47.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
