45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Copyright (c) 2002-2018 Dovecot authors, see the included COPYING file */
45e9809aff7304721fddb95654901b32195c9c7avboxsyncconst char *failure_log_type_prefixes[LOG_TYPE_COUNT] = {
45e9809aff7304721fddb95654901b32195c9c7avboxsync "Warning: ",
45e9809aff7304721fddb95654901b32195c9c7avboxsyncconst char *failure_log_type_names[LOG_TYPE_COUNT] = {
45e9809aff7304721fddb95654901b32195c9c7avboxsync "debug", "info", "warning", "error", "fatal", "panic"
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Initialize working defaults */
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstatic failure_callback_t *fatal_handler ATTR_NORETURN =
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstatic failure_callback_t *error_handler = default_error_handler;
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstatic failure_callback_t *info_handler = default_error_handler;
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstatic failure_callback_t *debug_handler = default_error_handler;
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstatic struct failure_context failure_ctx_debug = { .type = LOG_TYPE_DEBUG };
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstatic struct failure_context failure_ctx_info = { .type = LOG_TYPE_INFO };
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstatic struct failure_context failure_ctx_warning = { .type = LOG_TYPE_WARNING };
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstatic struct failure_context failure_ctx_error = { .type = LOG_TYPE_ERROR };
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstatic int log_fd = STDERR_FILENO, log_info_fd = STDERR_FILENO,
unsigned int timestamp_usecs)
return log_stamp_format;
if (ret > 0) {
if (ret == 0) {
switch (errno) {
case EAGAIN: {
case EINTR:
} else if (terminal_eintr_count++ == 0) {
recursed++;
T_BEGIN {
} T_END;
ret = 0;
recursed--;
return ret;
static void ATTR_NORETURN
recursed++;
recursed--;
abort();
case LOG_TYPE_DEBUG:
case LOG_TYPE_INFO:
abort();
case LOG_TYPE_DEBUG:
case LOG_TYPE_INFO:
i_unreached();
i_unreached();
i_unreached();
recursed++;
T_BEGIN {
} T_END;
recursed--;
case LOG_TYPE_DEBUG:
case LOG_TYPE_INFO:
case LOG_TYPE_WARNING:
case LOG_TYPE_ERROR:
case LOG_TYPE_FATAL:
case LOG_TYPE_PANIC:
case LOG_TYPE_COUNT:
case LOG_TYPE_OPTION:
i_unreached();
path);
/* if info/debug logs are elsewhere, i_set_info/debug_file()
recursed++;
T_BEGIN {
} T_END;
ret = 0;
recursed--;
return ret;
bool *replace_prefix_r)
return FALSE;
return FALSE;
log_type--;
return FALSE;
return TRUE;
line++;
if (p == NULL)