@@ -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",
@@ -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;
@@ -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);
@@ -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.");
@@ -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);
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 <liuhangbin@gmail.com> --- 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(-)