type-props: New macro for estimating length of a decimal integer.
[sliver-openvswitch.git] / lib / vlog.h
index 60b1a33..00d324f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <stdarg.h>
 #include <stdbool.h>
 #include <time.h>
+#include "compiler.h"
 #include "util.h"
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
-/* Logging importance levels. */
+/* Logging importance levels.
+ *
+ * The following log levels, in descending order of importance, are enabled by
+ * default:
+ *
+ *   - EMER: Not currently used.
+ *
+ *   - ERR: A high-level operation or a subsystem failed.  Attention is
+ *     warranted.
+ *
+ *   - WARN: A low-level operation failed, but higher-level subsystems may be
+ *     able to recover.
+ *
+ *   - INFO: Information that may be useful in retrospect when investigating
+ *     a problem.
+ *
+ * The lowest log level is not enabled by default:
+ *
+ *   - DBG: Information useful only to someone with intricate knowledge of the
+ *     system, or that would commonly cause too-voluminous log output.
+ */
 #define VLOG_LEVELS                             \
     VLOG_LEVEL(EMER, LOG_ALERT)                 \
     VLOG_LEVEL(ERR, LOG_ERR)                    \
@@ -132,13 +153,13 @@ int vlog_reopen_log_file(void);
 void vlog_init(void);
 void vlog_exit(void);
 void vlog(const struct vlog_module *, enum vlog_level, const char *format, ...)
-    __attribute__((format(printf, 3, 4)));
+    PRINTF_FORMAT (3, 4);
 void vlog_valist(const struct vlog_module *, enum vlog_level,
                  const char *, va_list)
-    __attribute__((format(printf, 3, 0)));
+    PRINTF_FORMAT (3, 0);
 void vlog_rate_limit(const struct vlog_module *, enum vlog_level,
                      struct vlog_rate_limit *, const char *, ...)
-    __attribute__((format(printf, 4, 5)));
+    PRINTF_FORMAT (4, 5);
 
 /* Creates and initializes a global instance of a module named MODULE, and
  * defines a static variable named THIS_MODULE that points to it, for use with