1 | /* $Id: VBoxMouseLog.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Mouse drivers, logging helper
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef GA_INCLUDED_SRC_WINNT_Mouse_common_VBoxMouseLog_h
|
---|
29 | #define GA_INCLUDED_SRC_WINNT_Mouse_common_VBoxMouseLog_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <VBox/log.h>
|
---|
35 | #include <iprt/assert.h>
|
---|
36 |
|
---|
37 | #define VBOX_MOUSE_LOG_NAME "VBoxMouse"
|
---|
38 |
|
---|
39 | /* Uncomment to show file/line info in the log */
|
---|
40 | /*#define VBOX_MOUSE_LOG_SHOWLINEINFO*/
|
---|
41 |
|
---|
42 | #define VBOX_MOUSE_LOG_PREFIX_FMT VBOX_MOUSE_LOG_NAME"::"LOG_FN_FMT": "
|
---|
43 | #define VBOX_MOUSE_LOG_PREFIX_PARMS __PRETTY_FUNCTION__
|
---|
44 |
|
---|
45 | #ifdef VBOX_MOUSE_LOG_SHOWLINEINFO
|
---|
46 | # define VBOX_MOUSE_LOG_SUFFIX_FMT " (%s:%d)\n"
|
---|
47 | # define VBOX_MOUSE_LOG_SUFFIX_PARMS ,__FILE__, __LINE__
|
---|
48 | #else
|
---|
49 | # define VBOX_MOUSE_LOG_SUFFIX_FMT "\n"
|
---|
50 | # define VBOX_MOUSE_LOG_SUFFIX_PARMS
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | #define _LOGMSG(_logger, _a) \
|
---|
54 | do \
|
---|
55 | { \
|
---|
56 | _logger((VBOX_MOUSE_LOG_PREFIX_FMT, VBOX_MOUSE_LOG_PREFIX_PARMS)); \
|
---|
57 | _logger(_a); \
|
---|
58 | _logger((VBOX_MOUSE_LOG_SUFFIX_FMT VBOX_MOUSE_LOG_SUFFIX_PARMS)); \
|
---|
59 | } while (0)
|
---|
60 |
|
---|
61 | #if 1 /* Exclude yourself if you're not keen on this. */
|
---|
62 | # define BREAK_WARN() AssertFailed()
|
---|
63 | #else
|
---|
64 | # define BREAK_WARN() do {} while(0)
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | #define WARN(_a) \
|
---|
68 | do \
|
---|
69 | { \
|
---|
70 | Log((VBOX_MOUSE_LOG_PREFIX_FMT"WARNING! ", VBOX_MOUSE_LOG_PREFIX_PARMS)); \
|
---|
71 | Log(_a); \
|
---|
72 | Log((VBOX_MOUSE_LOG_SUFFIX_FMT VBOX_MOUSE_LOG_SUFFIX_PARMS)); \
|
---|
73 | BREAK_WARN(); \
|
---|
74 | } while (0)
|
---|
75 |
|
---|
76 | #define LOG(_a) _LOGMSG(Log, _a)
|
---|
77 | #define LOGREL(_a) _LOGMSG(LogRel, _a)
|
---|
78 | #define LOGF(_a) _LOGMSG(LogFlow, _a)
|
---|
79 | #define LOGF_ENTER() LOGF(("ENTER"))
|
---|
80 | #define LOGF_LEAVE() LOGF(("LEAVE"))
|
---|
81 |
|
---|
82 | #endif /* !GA_INCLUDED_SRC_WINNT_Mouse_common_VBoxMouseLog_h */
|
---|
83 |
|
---|