Log.h
Go to the documentation of this file.
1 /********************************************************************
2 *
3 * Project Artec 3D Scanning SDK
4 *
5 * Purpose: log code
6 *
7 * Copyright: Artec Group
8 *
9 ********************************************************************/
10 
11 #ifndef _ABASESDK_LOG_H_
12 #define _ABASESDK_LOG_H_
13 
14 #ifndef ABASESDK_DISABLE_TRACING
16 #include <wctype.h>
17 #include <cstdarg>
18 
19 namespace artec { namespace sdk { namespace base
20 {
21 
22 typedef int (* REPORT_HOOK)(int, const wchar_t *);
23 
24 const int RPTHOOK_INSTALL = 0;
25 const int RPTHOOK_REMOVE = 1;
26 
28 {
35 };
36 
37 extern "C"
38 {
39 
40 void ABASESDK_LINK_SPEC setOutputLevel( int mode );
41 
43 
45  int mode,
46  REPORT_HOOK newHook
47  );
48 
50  int verboseLevel,
51  const wchar_t * module,
52  const wchar_t * format,
53  ...);
54 
56  int verboseLevel,
57  const wchar_t * module,
58  const wchar_t * format,
59  va_list args);
60 
61 }
62 
63 #define ABASESDK_MESSAGE(severity, ...) { if (getOutputLevel() >= severity) report(severity, L"ABASE", __VA_ARGS__); }
64 #define ABASESDK_INFO(...) ABASESDK_MESSAGE(VerboseLevel_Info, __VA_ARGS__)
65 #define ABASESDK_ERROR(...) ABASESDK_MESSAGE(VerboseLevel_Error, __VA_ARGS__)
66 #define ABASESDK_WARNING(...) ABASESDK_MESSAGE(VerboseLevel_Warning, __VA_ARGS__)
67 #define ABASESDK_TRACE(...) ABASESDK_MESSAGE(VerboseLevel_Trace, __VA_ARGS__)
68 
69 } } } // namespace artec::sdk::base
70 
71 #else
72 
73 #define ABASESDK_MESSAGE(severity, ...) {}
74 #define ABASESDK_INFO(...) {}
75 #define ABASESDK_ERROR(...) {}
76 #define ABASESDK_WARNING(...) {}
77 #define ABASESDK_TRACE(...) {}
78 
79 #endif
80 
81 #endif // _ABASESDK_LOG_H_
int ABASESDK_LINK_SPEC getOutputLevel()
int(* REPORT_HOOK)(int, const wchar_t *)
Definition: Log.h:22
bool ABASESDK_LINK_SPEC setReportHook(int mode, REPORT_HOOK newHook)
void ABASESDK_LINK_SPEC report(int verboseLevel, const wchar_t *module, const wchar_t *format,...)
void ABASESDK_LINK_SPEC vReport(int verboseLevel, const wchar_t *module, const wchar_t *format, va_list args)
const int RPTHOOK_INSTALL
Definition: Log.h:24
#define ABASESDK_LINK_SPEC
Definition: BaseSdkDefines.h:7
const int RPTHOOK_REMOVE
Definition: Log.h:25
void ABASESDK_LINK_SPEC setOutputLevel(int mode)