From patchwork Wed Nov 6 09:48:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 11229845 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 9C1781599 for ; Wed, 6 Nov 2019 09:49:34 +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 7A9A52173B for ; Wed, 6 Nov 2019 09:49:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A9A52173B 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 DA5286069A6B; Wed, 6 Nov 2019 09:49:33 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org DA5286069A6B Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id D3D955AA79C64; Wed, 6 Nov 2019 09:49:33 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id 77B155AA79C9D; Wed, 6 Nov 2019 09:49:26 +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 8B6905AA79C9B for ; Wed, 6 Nov 2019 09:49:25 +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 25DE5605D248 for ; Wed, 6 Nov 2019 09:49:25 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id c13so18443936pfp.5 for ; Wed, 06 Nov 2019 01:49:25 -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=nmRLbLcmwUCNYDfBuZCB1hkIHOaWRQqQi7QGaXeYPOk=; b=roz7m3659lfdn+fMu1vYEN9cNaPt7kZoEibJZfEAbrnqoPW0Zc8Hw6u+mxZRUX2SDQ wmZhIANmXc6dZKfz74Aj8iyM0cMtKeX/GtzqJDhs+ORGj1NRbmhfjjyzO+v7VZk8jULg 3GJHGwr5K7duINcT4ylAeiQxHzpYK9h8w4K41Ri6LoEvnqj7CJ3RLpprU6rPoInqZchy /7AFv5n11b7Dcbkp1N/DQN/X72P6zxfKrwzwRngM7Hk1P2KPBC7Hx9n8qeI2LHKhEdvB ef6IJacbvJhfTqELQ6bMRNkKcVZCJtoPcBUdDrkkXqVUEwwPNX8XOb0A/QeX5XlqsuOq xe+Q== X-Gm-Message-State: APjAAAVBzVkZ7tQHjfadFybQtL5hvQcA0SCCdH19nnivzxE9kvrROT8W F97GS25SegrmQh+Y3eKJhafNVi5D+bO4Lw== X-Google-Smtp-Source: APXvYqwnhSD0QTEiNTXxnEKjeeKRM5+DhcEHUfjbet2Lv2iCWIMBi+Q7EFVAYZwMLqXghvV1n40U7w== X-Received: by 2002:a63:7805:: with SMTP id t5mr1836132pgc.284.1573033764064; Wed, 06 Nov 2019 01:49:24 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2019 01:49:23 -0800 (PST) From: Hangbin Liu To: libteam@lists.fedorahosted.org Subject: [libteam PATCH 6/6] teamd: move teamd_log_dbg to teamd_log_dbgx Date: Wed, 6 Nov 2019 17:48:55 +0800 Message-Id: <20191106094855.13859-7-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: U3SN3IDXQDCGM2UXHZJ5AGGLTDC7JYBZ X-Message-ID-Hash: U3SN3IDXQDCGM2UXHZJ5AGGLTDC7JYBZ 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 all left files. Signed-off-by: Hangbin Liu --- teamd/teamd_dbus.c | 6 +++--- teamd/teamd_hash_func.c | 2 +- teamd/teamd_per_port.c | 6 +++--- teamd/teamd_usock.c | 12 ++++++------ teamd/teamd_zmq.c | 10 +++++----- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/teamd/teamd_dbus.c b/teamd/teamd_dbus.c index cdf21b1..48ebe5a 100644 --- a/teamd/teamd_dbus.c +++ b/teamd/teamd_dbus.c @@ -178,7 +178,7 @@ static DBusHandlerResult message_handler(DBusConnection *con, msg_interface = dbus_message_get_interface(message); if (!method || !path || !msg_interface) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - teamd_log_dbg("dbus: %s.%s (%s)", msg_interface, method, path); + teamd_log_dbgx(ctx, 1, "dbus: %s.%s (%s)", msg_interface, method, path); if (!strcmp(method, "Introspect") && !strcmp(msg_interface, "org.freedesktop.DBus.Introspectable")) { @@ -504,7 +504,7 @@ int teamd_dbus_init(struct teamd_context *ctx) if (err) goto iface_fini; id = dbus_connection_get_server_id(ctx->dbus.con), - teamd_log_dbg("dbus: connected to %s with name %s", id, + teamd_log_dbgx(ctx, 1, "dbus: connected to %s with name %s", id, dbus_bus_get_unique_name(ctx->dbus.con)); dbus_free(id); return 0; @@ -541,7 +541,7 @@ int teamd_dbus_expose_name(struct teamd_context *ctx) err = dbus_bus_request_name(ctx->dbus.con, service_name, 0, &error); if (err == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - teamd_log_dbg("dbus: have name %s", service_name); + teamd_log_dbgx(ctx, 1, "dbus: have name %s", service_name); err = 0; } else if (dbus_error_is_set(&error)) { teamd_log_err("dbus: Failed to acquire %s: %s: %s", diff --git a/teamd/teamd_hash_func.c b/teamd/teamd_hash_func.c index 8923849..d19692a 100644 --- a/teamd/teamd_hash_func.c +++ b/teamd/teamd_hash_func.c @@ -170,7 +170,7 @@ int teamd_hash_func_set(struct teamd_context *ctx) int err; if (!teamd_config_path_exists(ctx, "$.runner.tx_hash")) { - teamd_log_dbg("No Tx hash recipe found in config."); + teamd_log_dbgx(ctx, 1, "No Tx hash recipe found in config."); err = teamd_hash_func_add_default_frags(ctx); if (err) return err; diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c index f98a90d..a625c97 100644 --- a/teamd/teamd_per_port.c +++ b/teamd/teamd_per_port.c @@ -340,7 +340,7 @@ int teamd_port_add_ifname(struct teamd_context *ctx, const char *port_name) uint32_t ifindex; ifindex = team_ifname2ifindex(ctx->th, port_name); - teamd_log_dbg("%s: Adding port (found ifindex \"%d\").", + teamd_log_dbgx(ctx, 1, "%s: Adding port (found ifindex \"%d\").", port_name, ifindex); return team_port_add(ctx->th, ifindex); } @@ -350,7 +350,7 @@ static int teamd_port_remove(struct teamd_context *ctx, { int err; - teamd_log_dbg("%s: Removing port (found ifindex \"%d\").", + teamd_log_dbgx(ctx, 1, "%s: Removing port (found ifindex \"%d\").", tdport->ifname, tdport->ifindex); err = team_port_remove(ctx->th, tdport->ifindex); if (err) @@ -444,7 +444,7 @@ int teamd_port_check_enable(struct teamd_context *ctx, else return 0; - teamd_log_dbg("%s: %s port", tdport->ifname, + teamd_log_dbgx(ctx, 1, "%s: %s port", tdport->ifname, new_enabled_state ? "Enabling": "Disabling"); err = team_set_port_enabled(ctx->th, tdport->ifindex, new_enabled_state); diff --git a/teamd/teamd_usock.c b/teamd/teamd_usock.c index c421c7a..d4769f1 100644 --- a/teamd/teamd_usock.c +++ b/teamd/teamd_usock.c @@ -171,28 +171,28 @@ static int process_rcv_msg(struct teamd_context *ctx, int sock, char *rcv_msg) str = teamd_usock_msg_getline(&rest); if (!str) { - teamd_log_dbg("usock: Incomplete message."); + teamd_log_dbgx(ctx, 1, "usock: Incomplete message."); return 0; } if (strcmp(TEAMD_USOCK_REQUEST_PREFIX, str)) { - teamd_log_dbg("usock: Unsupported message type."); + teamd_log_dbgx(ctx, 1, "usock: Unsupported message type."); return 0; } str = teamd_usock_msg_getline(&rest); if (!str) { - teamd_log_dbg("usock: Incomplete message."); + teamd_log_dbgx(ctx, 1, "usock: Incomplete message."); return 0; } if (!teamd_ctl_method_exists(str)) { - teamd_log_dbg("usock: Unknown method \"%s\".", str); + teamd_log_dbgx(ctx, 1, "usock: Unknown method \"%s\".", str); return 0; } usock_ops_priv.sock = sock; usock_ops_priv.rcv_msg_args = rest; - teamd_log_dbg("usock: calling method \"%s\"", str); + teamd_log_dbgx(ctx, 1, "usock: calling method \"%s\"", str); return teamd_ctl_method_call(ctx, str, &teamd_usock_ctl_method_ops, &usock_ops_priv); @@ -315,7 +315,7 @@ static int teamd_usock_sock_open(struct teamd_context *ctx) teamd_usock_get_sockpath(addr.sun_path, sizeof(addr.sun_path), ctx->team_devname); - teamd_log_dbg("usock: Using sockpath \"%s\"", addr.sun_path); + teamd_log_dbgx(ctx, 1, "usock: Using sockpath \"%s\"", addr.sun_path); err = unlink(addr.sun_path); if (err == -1 && errno != ENOENT) { teamd_log_err("usock: Failed to remove socket file."); diff --git a/teamd/teamd_zmq.c b/teamd/teamd_zmq.c index c39e38d..11dce8c 100644 --- a/teamd/teamd_zmq.c +++ b/teamd/teamd_zmq.c @@ -138,28 +138,28 @@ static int process_rcv_msg(struct teamd_context *ctx, char *rcv_msg) str = teamd_zmq_msg_getline(&rest); if (!str) { - teamd_log_dbg("zmq: Incomplete message."); + teamd_log_dbgx(ctx, 1, "zmq: Incomplete message."); return 0; } if (strcmp(TEAMD_ZMQ_REQUEST_PREFIX, str)) { - teamd_log_dbg("zmq: Unsupported message type."); + teamd_log_dbgx(ctx, 1, "zmq: Unsupported message type."); return 0; } str = teamd_zmq_msg_getline(&rest); if (!str) { - teamd_log_dbg("zmq: Incomplete message."); + teamd_log_dbgx(ctx, 1, "zmq: Incomplete message."); return 0; } if (!teamd_ctl_method_exists(str)) { - teamd_log_dbg("zmq: Unknown method \"%s\".", str); + teamd_log_dbgx(ctx, 1, "zmq: Unknown method \"%s\".", str); return 0; } zmq_ops_priv.sock = ctx->zmq.sock; zmq_ops_priv.rcv_msg_args = rest; - teamd_log_dbg("zmq: calling method \"%s\"", str); + teamd_log_dbgx(ctx, 1, "zmq: calling method \"%s\"", str); return teamd_ctl_method_call(ctx, str, &teamd_zmq_ctl_method_ops, &zmq_ops_priv);