]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-hibernate: Log via imap_client.event or connection.event
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 17 Aug 2020 10:08:50 +0000 (13:08 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Fri, 21 Aug 2020 08:51:13 +0000 (08:51 +0000)
src/imap-hibernate/imap-client.c
src/imap-hibernate/imap-hibernate-client.c
src/imap-hibernate/imap-master-connection.c

index 3ae7a99981b6f98da5f630190a924f5b4f1f1f50..ea4ee1e06ce8021fd8b173e7b0655b593fafc3b9 100644 (file)
@@ -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) {
index 6421637d510595071e837dbd0d0b04b968d08eee..00e322c7650a00a5e6b0a71f395de5cf23d7cc6d 100644 (file)
@@ -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;
index d522be3728040c10934c3f2d6a7e1a69fc1a2019..824fb09a41dd1628d89060d5c93460cf31d9aa78 100644 (file)
@@ -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);
 }