XQuartz: ASL: Update logging to support differnet levels and subsystems

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
Jeremy Huddleston 2011-06-01 20:45:58 -07:00
parent c0077b41b4
commit a66400f8db
2 changed files with 8 additions and 4 deletions

View 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)

View 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 */