XQuartz: ASL: Update logging to support differnet levels and subsystems
authorJeremy Huddleston <jeremyhu@apple.com>
Thu, 2 Jun 2011 03:45:58 +0000 (20:45 -0700)
committerJeremy Huddleston <jeremyhu@apple.com>
Thu, 2 Jun 2011 04:07:56 +0000 (21:07 -0700)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
hw/xquartz/darwin.c
hw/xquartz/darwin.h

index fa8d4ce..29ab836 100644 (file)
@@ -79,7 +79,7 @@
 
 aslclient aslc;
 
-void debug_asl (const char *file, const char *function, int line, const char *fmt, ...) {
+void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...) {
     va_list args;
     aslmsg msg = asl_new(ASL_TYPE_MSG);
 
@@ -93,10 +93,12 @@ void debug_asl (const char *file, const char *function, int line, const char *fm
             asl_set(msg, "Line", _line);
             free(_line);
         }
+        if(subsystem)
+            asl_set(msg, "Subsystem", subsystem);
     }
 
     va_start(args, fmt);
-    asl_vlog(aslc, msg, ASL_LEVEL_DEBUG, fmt, args);
+    asl_vlog(aslc, msg, level, fmt, args);
     va_end(args);
 
     if(msg)
index 659de43..aafc12f 100644 (file)
@@ -76,9 +76,11 @@ extern int              darwinMainScreenY;
 // bundle-main.c
 extern char *bundle_id_prefix;
 
-extern void debug_asl (const char *file, const char *function, int line, const char *fmt, ...) _X_ATTRIBUTE_PRINTF(4,5);
+_X_ATTRIBUTE_PRINTF(6,7)
+extern void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...);
 
-#define DEBUG_LOG(msg, args...) debug_asl(__FILE__, __FUNCTION__, __LINE__, msg, ##args);
+#define ASL_LOG(level, subsystem, msg, args...) xq_asl_log(level, subsystem, __FILE__, __FUNCTION__, __LINE__, msg, ##args)
+#define DEBUG_LOG(msg, args...) ASL_LOG(ASL_LEVEL_DEBUG, "XQuartz", msg, ##args)
 #define TRACE() DEBUG_LOG("TRACE")
 
 #endif  /* _DARWIN_H */