1 | /* $Id: VBoxMouseLog.h 37163 2011-05-20 11:46:18Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBox Mouse drivers, logging helper
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2011 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef VBOXMOUSELOG_H
|
---|
20 | #define VBOXMOUSELOG_H
|
---|
21 |
|
---|
22 | #define VBOX_MOUSE_LOG_NAME "VBoxMouse"
|
---|
23 |
|
---|
24 | /* Uncomment to show file/line info in the log */
|
---|
25 | /*#define VBOX_MOUSE_LOG_SHOWLINEINFO*/
|
---|
26 |
|
---|
27 | #define VBOX_MOUSE_LOG_PREFIX_FMT VBOX_MOUSE_LOG_NAME"::"LOG_FN_FMT": "
|
---|
28 | #define VBOX_MOUSE_LOG_PREFIX_PARMS __PRETTY_FUNCTION__
|
---|
29 |
|
---|
30 | #ifdef VBOX_MOUSE_LOG_SHOWLINEINFO
|
---|
31 | # define VBOX_MOUSE_LOG_SUFFIX_FMT " (%s:%d)\n"
|
---|
32 | # define VBOX_MOUSE_LOG_SUFFIX_PARMS ,__FILE__, __LINE__
|
---|
33 | #else
|
---|
34 | # define VBOX_MOUSE_LOG_SUFFIX_FMT "\n"
|
---|
35 | # define VBOX_MOUSE_LOG_SUFFIX_PARMS
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #define _LOGMSG(_logger, _a) \
|
---|
39 | do \
|
---|
40 | { \
|
---|
41 | _logger((VBOX_MOUSE_LOG_PREFIX_FMT, VBOX_MOUSE_LOG_PREFIX_PARMS)); \
|
---|
42 | _logger(_a); \
|
---|
43 | _logger((VBOX_MOUSE_LOG_SUFFIX_FMT VBOX_MOUSE_LOG_SUFFIX_PARMS)); \
|
---|
44 | } while (0)
|
---|
45 |
|
---|
46 | #define WARN(_a) \
|
---|
47 | do \
|
---|
48 | { \
|
---|
49 | Log((VBOX_MOUSE_LOG_PREFIX_FMT"WARNING! ", VBOX_MOUSE_LOG_PREFIX_PARMS)); \
|
---|
50 | Log(_a); \
|
---|
51 | Log((VBOX_MOUSE_LOG_SUFFIX_FMT VBOX_MOUSE_LOG_SUFFIX_PARMS)); \
|
---|
52 | } while (0)
|
---|
53 |
|
---|
54 | #define LOG(_a) _LOGMSG(Log, _a)
|
---|
55 | #define LOGREL(_a) _LOGMSG(LogRel, _a)
|
---|
56 | #define LOGF(_a) _LOGMSG(LogFlow, _a)
|
---|
57 | #define LOGF_ENTER() LOGF(("ENTER"))
|
---|
58 | #define LOGF_LEAVE() LOGF(("LEAVE"))
|
---|
59 |
|
---|
60 | #endif /*VBOXMOUSELOG_H*/
|
---|