VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/common/VBoxVideoLog.h@ 69500

Last change on this file since 69500 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/* $Id: VBoxVideoLog.h 69500 2017-10-28 15:14:05Z vboxsync $ */
2/** @file
3 * VBox Video drivers, logging helper
4 */
5
6/*
7 * Copyright (C) 2011-2017 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 VBOXVIDEOLOG_H
19#define VBOXVIDEOLOG_H
20
21#ifndef VBOX_VIDEO_LOG_NAME
22# error VBOX_VIDEO_LOG_NAME should be defined!
23#endif
24
25#ifndef VBOX_VIDEO_LOG_LOGGER
26# define VBOX_VIDEO_LOG_LOGGER Log
27#endif
28
29#ifndef VBOX_VIDEO_LOGREL_LOGGER
30# define VBOX_VIDEO_LOGREL_LOGGER LogRel
31#endif
32
33#ifndef VBOX_VIDEO_LOGFLOW_LOGGER
34# define VBOX_VIDEO_LOGFLOW_LOGGER LogFlow
35#endif
36
37#ifndef VBOX_VIDEO_LOG_FN_FMT
38# define VBOX_VIDEO_LOG_FN_FMT LOG_FN_FMT
39#endif
40
41#ifndef VBOX_VIDEO_LOG_FORMATTER
42# define VBOX_VIDEO_LOG_FORMATTER(_logger, _severity, _a) \
43 do \
44 { \
45 _logger((VBOX_VIDEO_LOG_PREFIX_FMT _severity, VBOX_VIDEO_LOG_PREFIX_PARMS)); \
46 _logger(_a); \
47 _logger((VBOX_VIDEO_LOG_SUFFIX_FMT VBOX_VIDEO_LOG_SUFFIX_PARMS)); \
48 } while (0)
49#endif
50
51/* Uncomment to show file/line info in the log */
52/*#define VBOX_VIDEO_LOG_SHOWLINEINFO*/
53
54#define VBOX_VIDEO_LOG_PREFIX_FMT VBOX_VIDEO_LOG_NAME"::"VBOX_VIDEO_LOG_FN_FMT": "
55#define VBOX_VIDEO_LOG_PREFIX_PARMS __FUNCTION__
56
57#ifdef VBOX_VIDEO_LOG_SHOWLINEINFO
58# define VBOX_VIDEO_LOG_SUFFIX_FMT " (%s:%d)\n"
59# define VBOX_VIDEO_LOG_SUFFIX_PARMS ,__FILE__, __LINE__
60#else
61# define VBOX_VIDEO_LOG_SUFFIX_FMT "\n"
62# define VBOX_VIDEO_LOG_SUFFIX_PARMS
63#endif
64
65#ifdef DEBUG_misha
66# define BP_WARN() AssertFailed()
67#else
68# define BP_WARN() do {} while(0)
69#endif
70
71#define _LOGMSG_EXACT(_logger, _a) \
72 do \
73 { \
74 _logger(_a); \
75 } while (0)
76
77#define _LOGMSG(_logger, _severity, _a) \
78 do \
79 { \
80 VBOX_VIDEO_LOG_FORMATTER(_logger, _severity, _a); \
81 } while (0)
82
83/* we can not print paged strings to RT logger, do it this way */
84#define _LOGMSG_STR(_logger, _a, _f) do {\
85 int _i = 0; \
86 for (;(_a)[_i];++_i) { \
87 _logger(("%"_f, (_a)[_i])); \
88 }\
89 _logger(("\n")); \
90 } while (0)
91
92#ifdef VBOX_WDDM_MINIPORT
93# define _WARN_LOGGER VBOX_VIDEO_LOGREL_LOGGER
94#else
95# define _WARN_LOGGER VBOX_VIDEO_LOG_LOGGER
96#endif
97
98#define WARN_NOBP(_a) _LOGMSG(_WARN_LOGGER, "WARNING! :", _a)
99#define WARN(_a) \
100 do \
101 { \
102 WARN_NOBP(_a); \
103 BP_WARN(); \
104 } while (0)
105
106#define ASSERT_WARN(_a, _w) do {\
107 if(!(_a)) { \
108 WARN(_w); \
109 }\
110 } while (0)
111
112#define STOP_FATAL() do { \
113 AssertReleaseFailed(); \
114 } while (0)
115#define ERR(_a) do { \
116 _LOGMSG(VBOX_VIDEO_LOGREL_LOGGER, "FATAL! :", _a); \
117 STOP_FATAL(); \
118 } while (0)
119
120#define _DBGOP_N_TIMES(_count, _op) do { \
121 static int fDoWarnCount = (_count); \
122 if (fDoWarnCount) { \
123 --fDoWarnCount; \
124 _op; \
125 } \
126 } while (0)
127
128#define WARN_ONCE(_a) do { \
129 _DBGOP_N_TIMES(1, WARN(_a)); \
130 } while (0)
131
132
133#define LOG(_a) _LOGMSG(VBOX_VIDEO_LOG_LOGGER, "", _a)
134#define LOGREL(_a) _LOGMSG(VBOX_VIDEO_LOGREL_LOGGER, "", _a)
135#define LOGF(_a) _LOGMSG(VBOX_VIDEO_LOGFLOW_LOGGER, "", _a)
136#define LOGF_ENTER() LOGF(("ENTER"))
137#define LOGF_LEAVE() LOGF(("LEAVE"))
138#define LOG_EXACT(_a) _LOGMSG_EXACT(VBOX_VIDEO_LOG_LOGGER, _a)
139#define LOGREL_EXACT(_a) _LOGMSG_EXACT(VBOX_VIDEO_LOGREL_LOGGER, _a)
140#define LOGF_EXACT(_a) _LOGMSG_EXACT(VBOX_VIDEO_LOGFLOW_LOGGER, _a)
141/* we can not print paged strings to RT logger, do it this way */
142#define LOG_STRA(_a) do {\
143 _LOGMSG_STR(VBOX_VIDEO_LOG_LOGGER, _a, "c"); \
144 } while (0)
145#define LOG_STRW(_a) do {\
146 _LOGMSG_STR(VBOX_VIDEO_LOG_LOGGER, _a, "c"); \
147 } while (0)
148#define LOGREL_STRA(_a) do {\
149 _LOGMSG_STR(VBOX_VIDEO_LOGREL_LOGGER, _a, "c"); \
150 } while (0)
151#define LOGREL_STRW(_a) do {\
152 _LOGMSG_STR(VBOX_VIDEO_LOGREL_LOGGER, _a, "c"); \
153 } while (0)
154
155
156#endif /*VBOXVIDEOLOG_H*/
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette