aboutsummaryrefslogtreecommitdiff
path: root/lib/vlog.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-07-28 10:19:42 -0700
committerJustin Pettit <jpettit@nicira.com>2011-08-01 13:23:19 -0700
commitc1a543a8d6d2847983b6b0defd1e19777da85715 (patch)
tree32c38ed3a899a4911e2337a0fe7e2f426bf23a83 /lib/vlog.h
parent733a287e17bf3764bf31c9528c6b6d30aafdec5f (diff)
vlog: Add a new log level "off".
Until now, "emer" has effectively been "off" because no messages were ever logged at "emer" level. Justin points out that it is useful to use "emer" for messages that indicate a fatal error. This commit makes that change and adds a new "off" level to really turn off all logging to a facility.
Diffstat (limited to 'lib/vlog.h')
-rw-r--r--lib/vlog.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/vlog.h b/lib/vlog.h
index 7c439f22..aa98c06e 100644
--- a/lib/vlog.h
+++ b/lib/vlog.h
@@ -28,12 +28,13 @@
extern "C" {
#endif
-/* Logging importance levels.
+/* Logging severity levels.
*
- * The following log levels, in descending order of importance, are enabled by
+ * A logging severity level of OFF suppresses logging. Messages at the
+ * following log levels, in descending order of importance, are enabled by
* default:
*
- * - EMER: Not currently used.
+ * - EMER: The process is aborting due to unrecoverable failure.
*
* - ERR: A high-level operation or a subsystem failed. Attention is
* warranted.
@@ -50,6 +51,7 @@ extern "C" {
* system, or that would commonly cause too-voluminous log output.
*/
#define VLOG_LEVELS \
+ VLOG_LEVEL(OFF, LOG_ALERT) \
VLOG_LEVEL(EMER, LOG_ALERT) \
VLOG_LEVEL(ERR, LOG_ERR) \
VLOG_LEVEL(WARN, LOG_WARNING) \
@@ -163,12 +165,10 @@ void vlog_valist(const struct vlog_module *, enum vlog_level,
const char *, va_list)
PRINTF_FORMAT (3, 0);
-void vlog_fatal(const struct vlog_module *, enum vlog_level,
- const char *format, ...)
- PRINTF_FORMAT (3, 4) NO_RETURN;
-void vlog_fatal_valist(const struct vlog_module *, enum vlog_level,
- const char *, va_list)
- PRINTF_FORMAT (3, 0) NO_RETURN;
+void vlog_fatal(const struct vlog_module *, const char *format, ...)
+ PRINTF_FORMAT (2, 3) NO_RETURN;
+void vlog_fatal_valist(const struct vlog_module *, const char *format, va_list)
+ PRINTF_FORMAT (2, 0) NO_RETURN;
void vlog_rate_limit(const struct vlog_module *, enum vlog_level,
struct vlog_rate_limit *, const char *, ...)
@@ -187,7 +187,7 @@ void vlog_rate_limit(const struct vlog_module *, enum vlog_level,
*
* Guaranteed to preserve errno.
*/
-#define VLOG_FATAL(...) vlog_fatal(THIS_MODULE, VLL_ERR, __VA_ARGS__)
+#define VLOG_FATAL(...) vlog_fatal(THIS_MODULE, __VA_ARGS__)
#define VLOG_EMER(...) VLOG(VLL_EMER, __VA_ARGS__)
#define VLOG_ERR(...) VLOG(VLL_ERR, __VA_ARGS__)
#define VLOG_WARN(...) VLOG(VLL_WARN, __VA_ARGS__)
@@ -197,7 +197,6 @@ void vlog_rate_limit(const struct vlog_module *, enum vlog_level,
/* More convenience macros, for testing whether a given level is enabled in
* THIS_MODULE. When constructing a log message is expensive, this enables it
* to be skipped. */
-#define VLOG_IS_EMER_ENABLED() true
#define VLOG_IS_ERR_ENABLED() vlog_is_enabled(THIS_MODULE, VLL_ERR)
#define VLOG_IS_WARN_ENABLED() vlog_is_enabled(THIS_MODULE, VLL_WARN)
#define VLOG_IS_INFO_ENABLED() vlog_is_enabled(THIS_MODULE, VLL_INFO)