]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes in shared code that don't affect open-vm-tools functionality.
authorVMware, Inc <>
Tue, 19 Oct 2010 18:36:46 +0000 (11:36 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Tue, 19 Oct 2010 18:36:46 +0000 (11:36 -0700)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/include/log.h

index d44febffd59f763f2e3bb7e24c1f2a495dc2800f..3e312bae7d2a8c33ca7abf5209237ef378053831 100644 (file)
 #include <stdarg.h>
 
 /*
- * The level or "importance" of a message is as follows:
+ * The log levels are taken from POSIXen syslog and extended. We hijack the
+ * standard values on POSIXen and provide equivalent defines on all other
+ * platforms. Then the debugging levels are extended "down" to allow for
+ * multiple levels of debugging "noise".
+ *
+ * The conceptual model is as follows:
+ *
+ * LOG_EMERG       0   (highest priority)
+ * LOG_ALERT       1
+ * LOG_CRIT        2
+ * LOG_ERR         3
+ * LOG_WARNING     4   (<= this priority is written to stderr by default)
+ * LOG_NOTICE      5
+ * LOG_INFO        6   (<= this priority are logged by default)
+ * LOG_DEBUG_00    7   (noisiest level of debugging; also LOG_DEBUG)
+ * LOG_DEBUG_01    8 
+ * LOG_DEBUG_02    9 
+ * LOG_DEBUG_03    10 
+ * LOG_DEBUG_04    11 
+ * LOG_DEBUG_05    12 
+ * LOG_DEBUG_06    13 
+ * LOG_DEBUG_07    14 
+ * LOG_DEBUG_08    15 
+ * LOG_DEBUG_09    16 
+ * LOG_DEBUG_10    17  (lowest priority; least noisy debugging level)
  */
 
-typedef enum {
-   VMW_LOG_EMERG,     // highest priority
-   VMW_LOG_ALERT,
-   VMW_LOG_CRIT,
-   VMW_LOG_ERR,
-   VMW_LOG_WARNING,   // <= this priority goes to stderr by default
-   VMW_LOG_NOTICE,
-   VMW_LOG_INFO,      // <= this priority are logged by default
-   VMW_LOG_DEBUG_00,  // noisiest level of debugging
-   VMW_LOG_DEBUG_01,
-   VMW_LOG_DEBUG_02,
-   VMW_LOG_DEBUG_03,
-   VMW_LOG_DEBUG_04,
-   VMW_LOG_DEBUG_05,
-   VMW_LOG_DEBUG_06,
-   VMW_LOG_DEBUG_07,
-   VMW_LOG_DEBUG_08,
-   VMW_LOG_DEBUG_09,
-   VMW_LOG_DEBUG_10   // lowest priority; least noisy debugging level
-} VMWLogLevel;
+#if defined(_WIN32)
+#define LOG_EMERG    0
+#define LOG_ALERT    1
+#define LOG_CRIT     2
+#define LOG_ERR      3
+#define LOG_WARNING  4
+#define LOG_NOTICE   5
+#define LOG_INFO     6
+#define LOG_DEBUG    7
+#else
+#   if !defined(VMM)
+#      include <syslog.h>
+#   endif
+#endif
+
+#define LOG_DEBUG_00    LOG_DEBUG + 0
+#define LOG_DEBUG_01    LOG_DEBUG + 1
+#define LOG_DEBUG_02    LOG_DEBUG + 2
+#define LOG_DEBUG_03    LOG_DEBUG + 3
+#define LOG_DEBUG_04    LOG_DEBUG + 4
+#define LOG_DEBUG_05    LOG_DEBUG + 5
+#define LOG_DEBUG_06    LOG_DEBUG + 6
+#define LOG_DEBUG_07    LOG_DEBUG + 7
+#define LOG_DEBUG_08    LOG_DEBUG + 8
+#define LOG_DEBUG_09    LOG_DEBUG + 9
+#define LOG_DEBUG_10    LOG_DEBUG + 10
 
 typedef void (LogBasicFunc)(const char *fmt,
                             va_list args);
@@ -77,8 +107,8 @@ typedef struct
    Bool           fastRotation;         // ESX log rotation optimization
    Bool           preventRemove;        // prevert Log_RemoveFile(FALSE)
 
-   VMWLogLevel    stderrMinLevel;       // This level and above to stderr
-   VMWLogLevel    logMinLevel;          // This level and above to log
+   int32          stderrMinLevel;       // This level and above to stderr
+   int32          logMinLevel;          // This level and above to log
 
    uint32         keepOld;              // Number of old logs to keep
    uint32         throttleThreshold;    // Threshold for throttling
@@ -146,11 +176,11 @@ void LogV(const char *fmt,
 void WarningV(const char *fmt,
               va_list args);
 
-void Log_Level(VMWLogLevel level,
+void Log_Level(int level,
                const char *fmt,
                ...);
 
-void Log_LevelV(VMWLogLevel level,
+void Log_LevelV(int level,
                 const char *fmt,
                 va_list args);