]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Introduce abstraction for failure logging implementations.
authorSergey Kitov <sergey.kitov@open-xchange.com>
Tue, 12 Jun 2018 12:56:46 +0000 (15:56 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Fri, 7 Sep 2018 07:23:26 +0000 (10:23 +0300)
src/lib/failures.c

index e8de68a8cc5efc326036e21b2591df89776c362e..560250758a61857e142b583f785f92e1e3e72308 100644 (file)
@@ -52,6 +52,26 @@ static char *log_stamp_format = NULL, *log_stamp_format_suffix = NULL;
 static bool failure_ignore_errors = FALSE, log_prefix_sent = FALSE;
 static bool coredump_on_error = FALSE;
 
+typedef int (*failure_write_to_file_t)(enum log_type type, string_t *data, size_t prefix_len);
+typedef string_t *(*failure_format_str_t)(const struct failure_context *ctx,
+                                 size_t *prefix_len_r, const char *format,
+                                 va_list args);
+typedef void (*failure_on_handler_failure_t)(const struct  failure_context *ctx);
+typedef void (*failure_post_handler_t)(const struct  failure_context *ctx);
+
+
+struct failure_handler_vfuncs {
+       failure_write_to_file_t write;
+       failure_format_str_t format;
+       failure_on_handler_failure_t on_handler_failure;
+       failure_post_handler_t post_handler;
+};
+
+struct failure_handler_config {
+       int fatal_err_reset;
+       struct failure_handler_vfuncs *v;
+};
+
 static void ATTR_FORMAT(2, 0)
 i_internal_error_handler(const struct failure_context *ctx,
                         const char *format, va_list args);