VirtualBox

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

Last change on this file since 42683 was 41472, checked in by vboxsync, 13 years ago

wddm/3d: enhanced logging

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
1/* $Id: VBoxVideoLog.h 41472 2012-05-29 07:12:42Z vboxsync $ */
2
3/** @file
4 * VBox Video drivers, logging helper
5 */
6
7/*
8 * Copyright (C) 2011 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 __PRETTY_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(VBOX_VIDEO_LOG_LOGGER, "WARNING! :", _a)
100#define WARN(_a) \
101 do \
102 { \
103 WARN_NOBP(_a); \
104 BP_WARN(); \
105 } while (0)
106#define ASSERT_WARN(_a, _w) do {\
107 if(!(_a)) { \
108 WARN(_w); \
109 }\
110 } while (0)
111
112#define LOG(_a) _LOGMSG(VBOX_VIDEO_LOG_LOGGER, "", _a)
113#define LOGREL(_a) _LOGMSG(VBOX_VIDEO_LOGREL_LOGGER, "", _a)
114#define LOGF(_a) _LOGMSG(VBOX_VIDEO_LOGFLOW_LOGGER, "", _a)
115#define LOGF_ENTER() LOGF(("ENTER"))
116#define LOGF_LEAVE() LOGF(("LEAVE"))
117#define LOG_EXACT(_a) _LOGMSG_EXACT(VBOX_VIDEO_LOG_LOGGER, _a)
118#define LOGREL_EXACT(_a) _LOGMSG_EXACT(VBOX_VIDEO_LOGREL_LOGGER, _a)
119#define LOGF_EXACT(_a) _LOGMSG_EXACT(VBOX_VIDEO_LOGFLOW_LOGGER, _a)
120/* we can not print paged strings to RT logger, do it this way */
121#define LOG_STRA(_a) do {\
122 _LOGMSG_STR(VBOX_VIDEO_LOG_LOGGER, _a, "c"); \
123 } while (0)
124#define LOG_STRW(_a) do {\
125 _LOGMSG_STR(VBOX_VIDEO_LOG_LOGGER, _a, "c"); \
126 } while (0)
127#define LOGREL_STRA(_a) do {\
128 _LOGMSG_STR(VBOX_VIDEO_LOGREL_LOGGER, _a, "c"); \
129 } while (0)
130#define LOGREL_STRW(_a) do {\
131 _LOGMSG_STR(VBOX_VIDEO_LOGREL_LOGGER, _a, "c"); \
132 } while (0)
133
134
135#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