Use DLOG for debug messages instead of printf (Thanks kruM)

This commit is contained in:
Michael Stapelberg 2010-03-19 18:48:36 +01:00
parent 0bb1b718d1
commit af00df9321
2 changed files with 8 additions and 5 deletions

View File

@ -3,7 +3,7 @@
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* *
* © 2009 Michael Stapelberg and contributors * © 2009-2010 Michael Stapelberg and contributors
* *
* See file LICENSE for license information. * See file LICENSE for license information.
* *
@ -12,6 +12,7 @@
#define _LOG_H #define _LOG_H
#include <stdarg.h> #include <stdarg.h>
#include <stdbool.h>
/** ##__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that /** ##__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that
is, delete the preceding comma */ is, delete the preceding comma */

View File

@ -3,7 +3,7 @@
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* *
* © 2009 Michael Stapelberg and contributors * © 2009-2010 Michael Stapelberg and contributors
* *
* See file LICENSE for license information. * See file LICENSE for license information.
* *
@ -14,6 +14,8 @@
#include <stdio.h> #include <stdio.h>
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include "log.h"
static const char *labelError[] = { static const char *labelError[] = {
"Success", "Success",
"BadRequest", "BadRequest",
@ -219,7 +221,7 @@ int format_event(xcb_generic_event_t *e) {
switch(e->response_type) { switch(e->response_type) {
case 0: case 0:
printf("Error %s on seqnum %d (%s).\n", DLOG("Error %s on seqnum %d (%s).\n",
labelError[*((uint8_t *) e + 1)], labelError[*((uint8_t *) e + 1)],
seqnum, seqnum,
labelRequest[*((uint8_t *) e + 10)]); labelRequest[*((uint8_t *) e + 10)]);
@ -227,13 +229,13 @@ int format_event(xcb_generic_event_t *e) {
default: default:
if (e->response_type > sizeof(labelEvent) / sizeof(char*)) if (e->response_type > sizeof(labelEvent) / sizeof(char*))
break; break;
printf("Event %s following seqnum %d%s.\n", DLOG("Event %s following seqnum %d%s.\n",
labelEvent[e->response_type], labelEvent[e->response_type],
seqnum, seqnum,
labelSendEvent[sendEvent]); labelSendEvent[sendEvent]);
break; break;
case XCB_KEYMAP_NOTIFY: case XCB_KEYMAP_NOTIFY:
printf("Event %s%s.\n", DLOG("Event %s%s.\n",
labelEvent[e->response_type], labelEvent[e->response_type],
labelSendEvent[sendEvent]); labelSendEvent[sendEvent]);
break; break;