diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-11-06 00:04:06 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-11-26 15:16:53 -0500 |
commit | 4104970ef78e40e976215cdb0d1b9170a213cc4b (patch) | |
tree | 7a4d7bdfda9849fde5362dd027a272f92be9b978 /src/shared | |
parent | 278ebf8d26f0ebf9d63d8aa1b91a2adbdd8aa4e0 (diff) |
manager: log some fatal errors at emergency level
This adds a new log_emergency() function, which is equivalent to
log_error() for non-PID-1, and logs at the highest priority for PID 1.
Some messages which occur before freezing are converted to use it.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/log.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/shared/log.h b/src/shared/log.h index a3e23a855c..8141e9dbb0 100644 --- a/src/shared/log.h +++ b/src/shared/log.h @@ -25,6 +25,8 @@ #include <stdarg.h> #include <syslog.h> #include <sys/signalfd.h> +#include <sys/types.h> +#include <unistd.h> #include <errno.h> #include "macro.h" @@ -151,11 +153,12 @@ do { \ log_meta((level), __FILE__, __LINE__, __func__, __VA_ARGS__); \ } while (0) -#define log_debug(...) log_full(LOG_DEBUG, __VA_ARGS__) -#define log_info(...) log_full(LOG_INFO, __VA_ARGS__) -#define log_notice(...) log_full(LOG_NOTICE, __VA_ARGS__) -#define log_warning(...) log_full(LOG_WARNING, __VA_ARGS__) -#define log_error(...) log_full(LOG_ERR, __VA_ARGS__) +#define log_debug(...) log_full(LOG_DEBUG, __VA_ARGS__) +#define log_info(...) log_full(LOG_INFO, __VA_ARGS__) +#define log_notice(...) log_full(LOG_NOTICE, __VA_ARGS__) +#define log_warning(...) log_full(LOG_WARNING, __VA_ARGS__) +#define log_error(...) log_full(LOG_ERR, __VA_ARGS__) +#define log_emergency(...) log_full(getpid() == 1 ? LOG_EMERG : LOG_ERR, __VA_ARGS__) #ifdef LOG_TRACE # define log_trace(...) log_debug(__VA_ARGS__) |