#ifndef FAILURES_H
#define FAILURES_H
struct ip_addr;
/* Default exit status codes that we could use. */
enum fatal_exit_status {
};
enum log_type {
};
struct failure_line {
bool disable_log_prefix;
const char *text;
};
struct failure_context {
unsigned int timestamp_usecs;
};
extern const char *failure_log_type_prefixes[];
extern const char *failure_log_type_names[];
/* Change failure handlers. */
#ifndef __cplusplus
#else
/* Older g++ doesn't like attributes in parameters */
#endif
/* Send failures to file. */
ATTR_FORMAT(2, 0);
/* Send failures to syslog() */
ATTR_FORMAT(2, 0);
/* Send failures to specified log file instead of stderr. */
/* Send errors to stderr using internal error protocol. */
void i_set_failure_internal(void);
/* If writing to log fails, ignore it instead of existing with
FATAL_LOGWRITE or FATAL_LOGERROR. */
void i_set_failure_ignore_errors(bool ignore);
/* Send informational messages to specified log file. i_set_failure_*()
functions modify the info file too, so call this function after them. */
void i_set_info_file(const char *path);
/* Send debug-level message to the given log file. The i_set_info_file()
function modifies also the debug log file, so call this function after it. */
void i_set_debug_file(const char *path);
/* Set the failure prefix. */
/* Set prefix to "". */
void i_unset_failure_prefix(void);
/* Returns the current failure prefix (never NULL). */
const char *i_get_failure_prefix(void);
/* Prefix failures with a timestamp. fmt is in strftime() format. */
void i_set_failure_timestamp_format(const char *fmt);
/* When logging with internal error protocol, update the process's current
IP address / log prefix by sending it to log process. This is mainly used to
improve the error message if the process crashes. */
void i_set_failure_send_prefix(const char *prefix);
/* Call the callback before exit()ing. The callback may update the status. */
/* Call the exit callback and exit() */
/* Parse a line logged using internal failure handler */
void failures_deinit(void);
#endif