XQuartz: Update DEBUG_LOG to report to ASL
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
parent
384eb45b94
commit
96ac4e61f4
|
@ -60,6 +60,7 @@
|
|||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define HAS_UTSNAME 1
|
||||
#include <sys/utsname.h>
|
||||
|
@ -76,9 +77,31 @@
|
|||
#include "quartzKeyboard.h"
|
||||
#include "quartz.h"
|
||||
|
||||
#ifdef ENABLE_DEBUG_LOG
|
||||
FILE *debug_log_fp = NULL;
|
||||
#endif
|
||||
aslclient aslc;
|
||||
|
||||
void debug_asl (const char *file, const char *function, int line, const char *fmt, ...) {
|
||||
va_list args;
|
||||
aslmsg msg = asl_new(ASL_TYPE_MSG);
|
||||
|
||||
if(msg) {
|
||||
char *_line;
|
||||
|
||||
asl_set(msg, "File", file);
|
||||
asl_set(msg, "Function", function);
|
||||
asprintf(&_line, "%d", line);
|
||||
if(_line) {
|
||||
asl_set(msg, "Line", _line);
|
||||
free(_line);
|
||||
}
|
||||
}
|
||||
|
||||
va_start(args, fmt);
|
||||
asl_vlog(aslc, msg, ASL_LEVEL_DEBUG, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
if(msg)
|
||||
asl_free(msg);
|
||||
}
|
||||
|
||||
/*
|
||||
* X server shared global variables
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include <X11/extensions/XKB.h>
|
||||
#include <assert.h>
|
||||
#include <asl.h>
|
||||
|
||||
#include "darwinfb.h"
|
||||
|
||||
|
@ -76,16 +76,9 @@ extern int darwinMainScreenY;
|
|||
// bundle-main.c
|
||||
extern char *bundle_id_prefix;
|
||||
|
||||
#define ENABLE_DEBUG_LOG 1
|
||||
extern void debug_asl (const char *file, const char *function, int line, const char *fmt, ...) _X_ATTRIBUTE_PRINTF(4,5);
|
||||
|
||||
#ifdef ENABLE_DEBUG_LOG
|
||||
extern FILE *debug_log_fp;
|
||||
#define DEBUG_LOG_NAME "x11-debug.txt"
|
||||
#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
|
||||
#else
|
||||
#define DEBUG_LOG(msg, args...)
|
||||
#endif
|
||||
|
||||
#define TRACE() DEBUG_LOG("\n")
|
||||
#define DEBUG_LOG(msg, args...) debug_asl(__FILE__, __FUNCTION__, __LINE__, msg, ##args);
|
||||
#define TRACE() DEBUG_LOG("TRACE")
|
||||
|
||||
#endif /* _DARWIN_H */
|
||||
|
|
|
@ -66,6 +66,8 @@
|
|||
/* From darwinEvents.c ... but don't want to pull in all the server cruft */
|
||||
void DarwinListenOnOpenFD(int fd);
|
||||
|
||||
extern aslclient aslc;
|
||||
|
||||
/* Ditto, from os/log.c */
|
||||
extern void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
|
||||
extern void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN;
|
||||
|
@ -485,7 +487,6 @@ static void ensure_path(const char *dir) {
|
|||
static void setup_console_redirect(const char *bundle_id) {
|
||||
char *asl_sender;
|
||||
char *asl_facility;
|
||||
aslclient aslc;
|
||||
|
||||
asprintf(&asl_sender, "%s.server", bundle_id);
|
||||
assert(asl_sender);
|
||||
|
|
|
@ -111,7 +111,11 @@ In addition to this server log, XQuartz sends messages to syslogd(8) using
|
|||
asl(3). These logs are sent to the __bundle_id_prefix__ facility, and you can
|
||||
watch these logs using the following syslog(1) command:
|
||||
.TP 8
|
||||
.B $ syslog -w -k Facility __bundle_id_prefix__
|
||||
.B $ syslog -w -k Facility eq __bundle_id_prefix__
|
||||
.PP
|
||||
or you can include extra information such as the file, line, and function where the message originated:
|
||||
.TP 8
|
||||
.B $ syslog -w -F '$(Time) $(Sender) <$(Level)> $(File):$(Line) $(Function) :: $(Message)' -k Facility eq __bundle_id_prefix__
|
||||
.PP
|
||||
By default, XQaurtz sets an ASL mask which prevents it from logging messages
|
||||
below the ASL_LEVEL_WARNING level (meaning almost all logging is done strictly
|
||||
|
|
|
@ -253,7 +253,7 @@ xprDisplayInit(void)
|
|||
{
|
||||
CGDisplayCount displayCount;
|
||||
|
||||
DEBUG_LOG("");
|
||||
TRACE();
|
||||
|
||||
CGGetActiveDisplayList(0, NULL, &displayCount);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user