From: Timo Sirainen Date: Mon, 17 Aug 2020 10:08:50 +0000 (+0300) Subject: imap-hibernate: Log via imap_client.event or connection.event X-Git-Tag: 2.3.13~364 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f8a13f869a6ccbd351bd8a4834b55b4afce6fee1;p=thirdparty%2Fdovecot%2Fcore.git imap-hibernate: Log via imap_client.event or connection.event --- diff --git a/src/imap-hibernate/imap-client.c b/src/imap-hibernate/imap-client.c index 3ae7a99981..ea4ee1e06c 100644 --- a/src/imap-hibernate/imap-client.c +++ b/src/imap-hibernate/imap-client.c @@ -189,7 +189,7 @@ imap_client_move_back_send_callback(void *context, struct ostream *output) /* send the fd first */ ret = fd_send(o_stream_get_fd(output), client->fd, str_data(str), 1); if (ret < 0) { - i_error("fd_send(%s) failed: %m", + e_error(client->event, "fd_send(%s) failed: %m", o_stream_get_name(output)); imap_client_destroy(&client, "Failed to recreate imap process"); return; @@ -237,7 +237,7 @@ static bool imap_client_try_move_back(struct imap_client *client) return TRUE; } else if (ret < 0) { /* failed to connect to the imap-master socket */ - i_error("Failed to unhibernate client: %s", error); + e_error(client->event, "Failed to unhibernate client: %s", error); imap_client_destroy(&client, error); return TRUE; } @@ -600,7 +600,8 @@ imap_client_create(int fd, const struct imap_client_state *state) if (var_expand_with_funcs(str, state->mail_log_prefix, imap_client_get_var_expand_table(client), funcs, fields, &error) <= 0) { - i_error("Failed to expand mail_log_prefix=%s: %s", + e_error(client->event, + "Failed to expand mail_log_prefix=%s: %s", state->mail_log_prefix, error); } client->log_prefix = p_strdup(pool, str_c(str)); @@ -648,7 +649,7 @@ void imap_client_destroy(struct imap_client **_client, const char *reason) if (reason != NULL) { /* the client input/output bytes don't count the DONE+IDLE by imap-hibernate, but that shouldn't matter much. */ - i_info("%s %s", reason, client->state.stats); + e_info(client->event, "%s %s", reason, client->state.stats); } if (client->state.anvil_sent) { diff --git a/src/imap-hibernate/imap-hibernate-client.c b/src/imap-hibernate/imap-hibernate-client.c index 6421637d51..00e322c765 100644 --- a/src/imap-hibernate/imap-hibernate-client.c +++ b/src/imap-hibernate/imap-hibernate-client.c @@ -180,7 +180,7 @@ imap_hibernate_client_input_args(struct connection *conn, const char *error; if (imap_hibernate_client_parse_input(args, pool, &state, &error) < 0) { - i_error("Failed to parse client input: %s", error); + e_error(conn->event, "Failed to parse client input: %s", error); o_stream_nsend_str(conn->output, t_strdup_printf( "-Failed to parse client input: %s\n", error)); return -1; @@ -206,7 +206,7 @@ imap_hibernate_client_input_line(struct connection *conn, const char *line) return 1; } if (client->finished) { - i_error("Received unexpected line: %s", line); + e_error(conn->event, "Received unexpected line: %s", line); return -1; } @@ -216,7 +216,7 @@ imap_hibernate_client_input_line(struct connection *conn, const char *line) fd = i_stream_unix_get_read_fd(conn->input); if (fd == -1) { - i_error("IMAP client fd not received"); + e_error(conn->event, "IMAP client fd not received"); return -1; } @@ -224,15 +224,17 @@ imap_hibernate_client_input_line(struct connection *conn, const char *line) args = p_strsplit_tabescaped(pool, line); ret = imap_hibernate_client_input_args(conn, (void *)args, fd, pool); if (ret >= 0 && client->debug) - i_debug("Create client with input: %s", line); + e_debug(conn->event, "Create client with input: %s", line); pool_unref(&pool); } else { fd = i_stream_unix_get_read_fd(conn->input); if (fd == -1) { - i_error("IMAP notify fd not received (input: %s)", line); + e_error(conn->event, + "IMAP notify fd not received (input: %s)", line); ret = -1; } else if (line[0] != '\0') { - i_error("Expected empty notify fd line from client, but got: %s", line); + e_error(conn->event, + "Expected empty notify fd line from client, but got: %s", line); o_stream_nsend_str(conn->output, "Expected empty notify fd line"); ret = -1; diff --git a/src/imap-hibernate/imap-master-connection.c b/src/imap-hibernate/imap-master-connection.c index d522be3728..824fb09a41 100644 --- a/src/imap-hibernate/imap-master-connection.c +++ b/src/imap-hibernate/imap-master-connection.c @@ -20,7 +20,8 @@ static struct connection_list *master_clients; static void imap_master_connection_timeout(struct imap_master_connection *conn) { - i_error("Timeout communicating with %s (version %sreceived)", + e_error(conn->conn.event, + "Timeout communicating with %s (version %sreceived)", conn->conn.name, conn->conn.version_received ? "" : "not "); imap_master_connection_deinit(&conn); }