libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
AssertToNTLog.hpp
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright © 2002 by J.M.McGuiness, coder@hussar.me.uk
3
**
4
** This library is free software; you can redistribute it and/or
5
** modify it under the terms of the GNU Lesser General Public
6
** License as published by the Free Software Foundation; either
7
** version 2.1 of the License, or (at your option) any later version.
8
**
9
** This library is distributed in the hope that it will be useful,
10
** but WITHOUT ANY WARRANTY; without even the implied warranty of
11
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
** Lesser General Public License for more details.
13
**
14
** You should have received a copy of the GNU Lesser General Public
15
** License along with this library; if not, write to the Free Software
16
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*/
18
19
#
pragma
once
20
21
#
include
<
cassert
>
22
23
/*
24
NOTE: All of this functionality is enabled ONLY in debug mode, i.e. if
25
"_DEBUG" is defined.
26
Handy for using in NT Services that don't have a user interface - send the
27
assertion to the NT Event Log.
28
Automatically logs the file and line number. Also the calling thread handle.
29
(Which is handy when multi-thread/process debugging!)
30
Include this file instead of <cassert> or <assert.h> if you want to log all
31
"assert(...)" expressions to the NT Event Log. (But only if you define the
32
macro constant "ASSERTIONS_TO_NT_LOG".)
33
Use "assert(...)" if you don't have an "EventLog" object in scope, otherwise
34
you can use "AssertLog(...)" instead which will make use of your provided
35
EventLog object.
36
*/
37
38
#
ifdef
_DEBUG
39
40
namespace
jmmcg {
41
42
namespace
LIBJMMCG_VER_NAMESPACE {
namespace
NTUtils {
43
44
inline
AFX_EXT_CLASS
void
__fastcall
assertlog(
const
char
*exp,
const
char
*file_name,
const
unsigned
long
line);
45
46
} }
47
48
#
define
AssertLog
(
exp
)
(
void
)
(
(
exp
)
||
(
jmmcg
::
LIBJMMCG_VER_NAMESPACE
::
NTUtils
::
assertlog
(
#
exp
,
__FILE__
,
__LINE__
)
,
0
)
)
49
#
ifdef
JMMCG_ASSERTIONS_TO_NT_LOG
50
#
ifdef
assert
51
#
undef
assert
52
#
endif
assert
53
#
define
assert
(
exp
)
AssertLog
(
exp
)
54
#
endif
JMMCG_ASSERTIONS_TO_NT_LOG
55
56
#
else
57
#
define
AssertLog
(
assertion
)
(
(
void
)
0
)
58
#
endif
_DEBUG
experimental
NT-based
NTSpecific
AssertToNTLog.hpp
Generated on Tue May 11 2021 17:31:28 for libjmmcg by
1.9.2