As libdaemon do not filter log messages when we use syslog as output, all debug messages will be printed to the syslog even if we set daemon_verbosity_level to LOG_INFO. This would make user full confused and annoying. Since we have a -g option to enable debug message specially, let's move all teamd_log_dbg to teamd_log_dbgx so user could choose to print debug message or not.
This patch will move all teamd_log_dbg to teamd_log_dbgx for teamd_runner_activebackup.c
Signed-off-by: Hangbin Liu liuhangbin@gmail.com --- teamd/teamd_runner_activebackup.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/teamd/teamd_runner_activebackup.c b/teamd/teamd_runner_activebackup.c index f92d341..9414497 100644 --- a/teamd/teamd_runner_activebackup.c +++ b/teamd/teamd_runner_activebackup.c @@ -255,7 +255,7 @@ static int ab_clear_active_port(struct teamd_context *ctx, struct ab *ab, ab->active_ifindex = 0; if (!tdport || !teamd_port_present(ctx, tdport)) return 0; - teamd_log_dbg("Clearing active port "%s".", tdport->ifname); + teamd_log_dbgx(ctx, 1, "Clearing active port "%s".", tdport->ifname);
err = team_set_port_enabled(ctx->th, tdport->ifindex, false); if (err) { @@ -368,9 +368,9 @@ static int ab_link_watch_handler(struct teamd_context *ctx, struct ab *ab)
active_tdport = teamd_get_port(ctx, ab->active_ifindex); if (active_tdport) { - teamd_log_dbg("Current active port: "%s" (ifindex "%d", prio "%d").", - active_tdport->ifname, active_tdport->ifindex, - teamd_port_prio(ctx, active_tdport)); + teamd_log_dbgx(ctx, 1, "Current active port: "%s" (ifindex "%d", prio "%d").", + active_tdport->ifname, active_tdport->ifindex, + teamd_port_prio(ctx, active_tdport));
err = team_get_active_port(ctx->th, &active_ifindex); if (err) { @@ -404,8 +404,8 @@ static int ab_link_watch_handler(struct teamd_context *ctx, struct ab *ab) if (!best.tdport || best.tdport == active_tdport) return 0;
- teamd_log_dbg("Found best port: "%s" (ifindex "%d", prio "%d").", - best.tdport->ifname, best.tdport->ifindex, best.prio); + teamd_log_dbgx(ctx, 1, "Found best port: "%s" (ifindex "%d", prio "%d").", + best.tdport->ifname, best.tdport->ifindex, best.prio);
if (!active_tdport || !ab_is_port_sticky(ab, active_tdport)) { err = ab_change_active_port(ctx, ab, active_tdport, @@ -459,8 +459,8 @@ static int ab_port_load_config(struct teamd_context *ctx, "$.ports.%s.sticky", port_name); if (err) ab_port->cfg.sticky = AB_DFLT_PORT_STICKY; - teamd_log_dbg("%s: Using sticky "%d".", port_name, - ab_port->cfg.sticky); + teamd_log_dbgx(ctx, 1, "%s: Using sticky "%d".", port_name, + ab_port->cfg.sticky); return 0; }
@@ -558,7 +558,7 @@ static int ab_load_config(struct teamd_context *ctx, struct ab *ab) hwaddr_policy_name); return err; } - teamd_log_dbg("Using hwaddr_policy "%s".", ab->hwaddr_policy->name); + teamd_log_dbgx(ctx, 1, "Using hwaddr_policy "%s".", ab->hwaddr_policy->name); return 0; }