libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
AssertToNTLog.cpp
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 #include "stdafx.h"
20 
21 #ifdef _DEBUG
22 
23 # include "AssertToNTLog.hpp"
24 # include "EventLog.hpp"
25 
26 #include "../../../core/info.hpp"
27 #include "../../../core/unicode_conversions.hpp"
28 
29 # include <string>
30 # include <sstream>
31 
32 using namespace libjmmcg;
33 
34 /////////////////////////////////////////////////////////////////////////////
35 
36 JMMCG_REVISION_CONSTANT(_T(LIBJMMCG_VERSION_NUMBER))
37 
38 /////////////////////////////////////////////////////////////////////////////
39 
40 namespace {
41  NTUtils::EventLog NTLog_D87A7F40_F129_11d4_B1AC_0001029FBE99_;
42 }
43 
44 inline void __fastcall
45 NTUtils::assertlog(const char *exp, const char *file_name, const unsigned long line) {
46  tstringstream ss;
47  ss<<_T("Debug assertion failed. File: '")<<StringToTString(file_name)
48  <<_T("'. Line: ")<<line
49  <<_T(". Process handle: 0x")<<::GetCurrentProcess()
50  <<_T(". Process ID: ")<<::GetCurrentProcessId()
51  <<_T(". Thread handle: 0x")<<::GetCurrentThread()
52  <<_T(". Thread ID: ")<<::GetCurrentThreadId()
53  <<_T(". Assertion: '")<<StringToTString(exp)<<_T("'.");
54  NTLog_D87A7F40_F129_11d4_B1AC_0001029FBE99_.Log(NTUtils::EventLog::err_error, NTUtils::EventLog::cat_error, ss);
55  exit(255);
56 }
57 
58 #endif _DEBUG