diff mbox series

teamd: lacp: use teamd_log_dbgx to print lacp info state

Message ID 20191018111218.24713-1-liuhangbin@gmail.com (mailing list archive)
State New
Headers show
Series teamd: lacp: use teamd_log_dbgx to print lacp info state | expand

Commit Message

Hangbin Liu Oct. 18, 2019, 11:12 a.m. UTC
When we set TEAM_LOG_OUTPUT=syslog in the environment, all the logs,
including debug info will be printed to syslog, even though we set
daemon_verbosity_level = LOG_INFO.

The reason is the function daemon_logv() of libdaemon only check the
daemon_verbosity_level for LOG_STDOUT and LOG_STDERR, not LOG_SYSLOG.
Also here is the quote for daemon_set_verbosity() from libdaemon/dlog.h
"""
Allows to decide which messages to output on standard output/error
streams. All messages are logged to syslog and this setting does
not influence that.
"""

So libdaemon is intend to print all logs to syslog. But when we also
enabled lacp fast_rate, the lacp state info may get a little annoying
as it will print the state info every second, even the log level is
LOG_INFO.

So let's use teamd_log_dbgx() to print lacp info state, which would
only print the state log message with -g option.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 teamd/teamd_runner_lacp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Hangbin Liu Oct. 23, 2019, 6:40 a.m. UTC | #1
Hi Jiri,

Would you please help review this patch?

Thanks
Hangbin
On Fri, Oct 18, 2019 at 07:12:18PM +0800, Hangbin Liu wrote:
> When we set TEAM_LOG_OUTPUT=syslog in the environment, all the logs,
> including debug info will be printed to syslog, even though we set
> daemon_verbosity_level = LOG_INFO.
> 
> The reason is the function daemon_logv() of libdaemon only check the
> daemon_verbosity_level for LOG_STDOUT and LOG_STDERR, not LOG_SYSLOG.
> Also here is the quote for daemon_set_verbosity() from libdaemon/dlog.h
> """
> Allows to decide which messages to output on standard output/error
> streams. All messages are logged to syslog and this setting does
> not influence that.
> """
> 
> So libdaemon is intend to print all logs to syslog. But when we also
> enabled lacp fast_rate, the lacp state info may get a little annoying
> as it will print the state info every second, even the log level is
> LOG_INFO.
> 
> So let's use teamd_log_dbgx() to print lacp info state, which would
> only print the state log message with -g option.
> 
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
>  teamd/teamd_runner_lacp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
> index d292d69..179b954 100644
> --- a/teamd/teamd_runner_lacp.c
> +++ b/teamd/teamd_runner_lacp.c
> @@ -929,8 +929,8 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port)
>  		state |= INFO_STATE_DEFAULTED;
>  	if (teamd_port_count(lacp_port->ctx) > 0)
>  		state |= INFO_STATE_AGGREGATION;
> -	teamd_log_dbg("%s: lacp info state: 0x%02X.", lacp_port->tdport->ifname,
> -						      state);
> +	teamd_log_dbgx(lacp_port->ctx, 1, "%s: lacp info state: 0x%02X.",
> +		       lacp_port->tdport->ifname, state);
>  	lacp_port->actor.state = state;
>  }
>  
> -- 
> 2.19.2
>
diff mbox series

Patch

diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index d292d69..179b954 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -929,8 +929,8 @@  static void lacp_port_actor_update(struct lacp_port *lacp_port)
 		state |= INFO_STATE_DEFAULTED;
 	if (teamd_port_count(lacp_port->ctx) > 0)
 		state |= INFO_STATE_AGGREGATION;
-	teamd_log_dbg("%s: lacp info state: 0x%02X.", lacp_port->tdport->ifname,
-						      state);
+	teamd_log_dbgx(lacp_port->ctx, 1, "%s: lacp info state: 0x%02X.",
+		       lacp_port->tdport->ifname, state);
 	lacp_port->actor.state = state;
 }