1 | /* $Id: VBoxVideoLog.h 37207 2011-05-24 23:11:29Z 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 | /* Uncomment to show file/line info in the log */
|
---|
27 | /*#define VBOX_VIDEO_LOG_SHOWLINEINFO*/
|
---|
28 |
|
---|
29 | #define VBOX_VIDEO_LOG_PREFIX_FMT VBOX_VIDEO_LOG_NAME"::"LOG_FN_FMT": "
|
---|
30 | #define VBOX_VIDEO_LOG_PREFIX_PARMS __PRETTY_FUNCTION__
|
---|
31 |
|
---|
32 | #ifdef VBOX_VIDEO_LOG_SHOWLINEINFO
|
---|
33 | # define VBOX_VIDEO_LOG_SUFFIX_FMT " (%s:%d)\n"
|
---|
34 | # define VBOX_VIDEO_LOG_SUFFIX_PARMS ,__FILE__, __LINE__
|
---|
35 | #else
|
---|
36 | # define VBOX_VIDEO_LOG_SUFFIX_FMT "\n"
|
---|
37 | # define VBOX_VIDEO_LOG_SUFFIX_PARMS
|
---|
38 | #endif
|
---|
39 |
|
---|
40 | #ifdef DEBUG_misha
|
---|
41 | # define BREAK_WARN() AssertFailed()
|
---|
42 | #else
|
---|
43 | # define BREAK_WARN() do {} while(0)
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | #define _LOGMSG(_logger, _a) \
|
---|
47 | do \
|
---|
48 | { \
|
---|
49 | _logger((VBOX_VIDEO_LOG_PREFIX_FMT, VBOX_VIDEO_LOG_PREFIX_PARMS)); \
|
---|
50 | _logger(_a); \
|
---|
51 | _logger((VBOX_VIDEO_LOG_SUFFIX_FMT VBOX_VIDEO_LOG_SUFFIX_PARMS)); \
|
---|
52 | } while (0)
|
---|
53 |
|
---|
54 | #define WARN(_a) \
|
---|
55 | do \
|
---|
56 | { \
|
---|
57 | Log((VBOX_VIDEO_LOG_PREFIX_FMT"WARNING! ", VBOX_VIDEO_LOG_PREFIX_PARMS)); \
|
---|
58 | Log(_a); \
|
---|
59 | Log((VBOX_VIDEO_LOG_SUFFIX_FMT VBOX_VIDEO_LOG_SUFFIX_PARMS)); \
|
---|
60 | BREAK_WARN(); \
|
---|
61 | } while (0)
|
---|
62 |
|
---|
63 | #define LOG(_a) _LOGMSG(Log, _a)
|
---|
64 | #define LOGREL(_a) _LOGMSG(LogRel, _a)
|
---|
65 | #define LOGF(_a) _LOGMSG(LogFlow, _a)
|
---|
66 | #define LOGF_ENTER() LOGF(("ENTER"))
|
---|
67 | #define LOGF_LEAVE() LOGF(("LEAVE"))
|
---|
68 |
|
---|
69 | #endif /*VBOXVIDEOLOG_H*/
|
---|