VirtualBox

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

Last change on this file since 55704 was 55704, checked in by vboxsync, 10 years ago

WDDM: FUNCTION is enough for logging

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