VirtualBox

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

Last change on this file since 83830 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

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