-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTRIMCORE_Log_Exception.tcc
59 lines (50 loc) · 2.05 KB
/
TRIMCORE_Log_Exception.tcc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef TRIMCORE_DLL_LOG_EXCEPTION_TCC
#define TRIMCORE_DLL_LOG_EXCEPTION_TCC
inline std::string TRIMCORE::Log::Exception::What () { return std::string (); }
inline TRIMCORE::Log::Exception::Exception (Log::Provider * object)
: std::runtime_error (What ())
, identity (object ? object->identity : Identity {})
, code (GetLastError ()) {
if (object) {
object->report (Log::Error, Log::LogSystemEvents::Exception);
} else {
::TRIMCORE::log (Log::Error, Log::LogSystemEvents::Exception);
}
}
inline TRIMCORE::Log::Exception::Exception (DWORD code, Log::Provider * object)
: std::runtime_error (What ())
, identity (object ? object->identity : Identity {})
, code (code) {
if (object) {
object->report (Log::Error, Log::LogSystemEvents::Exception, ApiError (code));
} else {
::TRIMCORE::log (Log::Error, Log::LogSystemEvents::Exception, ApiError (code));
}
}
template <typename... Args>
inline TRIMCORE::Log::Exception::Exception (Log::Provider * object, Log::EventID event, Args ...args)
: std::runtime_error (What ())
, identity (object ? object->identity : Identity {})
, code (GetLastError ()) {
if (object) {
object->report (Log::Error, event, args...);
object->report (Log::Error, Log::LogSystemEvents::Exception);
} else {
::TRIMCORE::log (Log::Error, event, args...);
::TRIMCORE::log (Log::Error, Log::LogSystemEvents::Exception);
}
}
template <typename... Args>
inline TRIMCORE::Log::Exception::Exception (DWORD code, Log::Provider * object, Log::EventID event, Args ...args)
: std::runtime_error (What ())
, identity (object ? object->identity : Identity {})
, code (code) {
if (object) {
object->report (Log::Error, event, args..., ApiError (code));
object->report (Log::Error, Log::LogSystemEvents::Exception, ApiError (code));
} else {
::TRIMCORE::log (Log::Error, event, args..., ApiError (code));
::TRIMCORE::log (Log::Error, Log::LogSystemEvents::Exception, ApiError (code));
}
}
#endif