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