From patchwork Wed Nov 6 09:48:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 11229837 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98295112B for ; Wed, 6 Nov 2019 09:49:20 +0000 (UTC) Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 755AE2178F for ; Wed, 6 Nov 2019 09:49:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 755AE2178F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=libteam-bounces@lists.fedorahosted.org Received: from mailman01.phx2.fedoraproject.org (mailman01.phx2.fedoraproject.org [10.5.126.36]) by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id EDB1D606156F; Wed, 6 Nov 2019 09:49:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org EDB1D606156F Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id E9D6B5AA79C7E; Wed, 6 Nov 2019 09:49:19 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id 681865AA79C9D; Wed, 6 Nov 2019 09:49:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mailman01.phx2.fedoraproject.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=disabled version=3.4.0 Received: from smtp-mm-ib01.fedoraproject.org (smtp-mm-ib01.vpn.fedoraproject.org [192.168.1.83]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id D61E65AA79C82 for ; Wed, 6 Nov 2019 09:49:16 +0000 (UTC) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by smtp-mm-ib01.fedoraproject.org (Postfix) with ESMTPS id 689DB605D243 for ; Wed, 6 Nov 2019 09:49:16 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id p26so18440698pfq.8 for ; Wed, 06 Nov 2019 01:49:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vD1L69hFP7bmnLuo+1FU4BvB3c9Edl1Qz1yeWLyJi9I=; b=RDUs1NVPpH4+AMNvLOFzcAOsZwKLTotJXb5dWO/GHuWyRNqVVEYPQftpZbt50nuGKt OhKKzRQ0gpLItSzIJ9tPnvXNvONEDVu7STf/9s9XmqREtxKLIrWCyzOCvSP6DzJEWn7E lqhVMQOX1OFklsDhU6NdmZpbWe4QXowOju+BgurQjljfOGK3ltmxQ+VKOWfFIaHIcUXk lrktDtW2LGoa+WubvLpJGkpaL85L6Ea2MC0XP+0gD4g43yng2MnNr6kqCWQRw+/WTOhn G9mbJFIrzcUHi4543pNen89JrQAHbO/ZXKUdD7G0lUF9pj7AQ2QZDW13QSo9y0ea8CaF Y56g== X-Gm-Message-State: APjAAAUKiAhW0u7Dook72ZkLCmFHvKyVmr4ogynXXyFl4NlEYr6mb+AM Px00vgYG+w5cn3Q5uern+jrqtlsQMvgkfA== X-Google-Smtp-Source: APXvYqw7yWCc3IZtnXebAJGhtOF1OFGFXVOow5KzmfrZghFoi0l1qvdhZ379Q06w5jiouP0km3+rsg== X-Received: by 2002:a63:de0b:: with SMTP id f11mr1840927pgg.8.1573033755271; Wed, 06 Nov 2019 01:49:15 -0800 (PST) Received: from dhcp-12-139.nay.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id j11sm22249238pgk.3.2019.11.06.01.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2019 01:49:14 -0800 (PST) From: Hangbin Liu To: libteam@lists.fedorahosted.org Subject: [libteam PATCH 2/6] teamd/teamd_runner_activebackup.c: move teamd_log_dbg to teamd_log_dbgx Date: Wed, 6 Nov 2019 17:48:51 +0800 Message-Id: <20191106094855.13859-3-liuhangbin@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20191106094855.13859-1-liuhangbin@gmail.com> References: <20191106094855.13859-1-liuhangbin@gmail.com> MIME-Version: 1.0 Message-ID-Hash: 7OXPOFQTU7PIWKSULWLSHZPFBJJSMDMD X-Message-ID-Hash: 7OXPOFQTU7PIWKSULWLSHZPFBJJSMDMD X-MailFrom: liuhangbin@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Hangbin Liu , Jiri Pirko X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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; }