diff options
author | Daniel Kurtz <djkurtz@chromium.org> | 2011-08-08 15:09:47 +0800 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-08-22 15:49:25 +1000 |
commit | cd8ee3e5cb29b9cd6402d2fbc71463c6b04b6077 (patch) | |
tree | 280988ba763d1eb28b6f4310fa88a9f931177edd | |
parent | b31d104fc09a7241856ff8d226be11ec562beac3 (diff) |
xf86Helper: use LogHdrMessageVerb in xf86VIDrvMsgVerb
LogHdrMessageVerb allows passing a parameterized header to insert in a log
message between MessageType and the formatted message body string.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | hw/xfree86/common/xf86Helper.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index f8e6c8b41..f42d0f9df 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1082,20 +1082,23 @@ xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...) } /* Print input driver messages in the standard format of - <driver>: <device name>: <message> */ + (<type>) <driver>: <device name>: <message> */ void -xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format, - va_list args) +xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, + const char *format, va_list args) { - char *msg; + const char *driverName = NULL; + const char *deviceName = NULL; - if (asprintf(&msg, "%s: %s: %s", dev->drv->driverName, dev->name, format) - == -1) { - LogVMessageVerb(type, verb, "%s", args); - } else { - LogVMessageVerb(type, verb, msg, args); - free(msg); + /* Prefix driver and device names to formatted message. */ + if (dev) { + deviceName = dev->name; + if (dev->drv) + driverName = dev->drv->driverName; } + + LogHdrMessageVerb(type, verb, format, args, "%s: %s: ", driverName, + deviceName); } /* Print input driver message, with verbose level specified directly */ |