Artec 3D Scanning SDK  2.0
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 
27 /// The level of detail of verbose output
29 {
30  VerboseLevel_Disable = -1, ///< Noting to output
31  VerboseLevel_Error, ///< Output errors
32  VerboseLevel_Warning, ///< Output errors and warnings
33  VerboseLevel_Info, ///< Output errors, warnings and information
34  VerboseLevel_Trace, ///< Comprehensive output
36 };
37 
38 extern "C"
39 {
40 
41 void ABASESDK_LINK_SPEC setOutputLevel( int mode );
42 
44 
46  int mode,
47  REPORT_HOOK newHook
48  );
49 
51  int verboseLevel,
52  const wchar_t * module,
53  const wchar_t * format,
54  ...);
55 
57  int verboseLevel,
58  const wchar_t * module,
59  const wchar_t * format,
60  va_list args);
61 
62 }
63 
64 #define ABASESDK_MESSAGE(severity, ...) { if (getOutputLevel() >= severity) report(severity, L"BASE", __VA_ARGS__); }
65 #define ABASESDK_INFO(...) ABASESDK_MESSAGE(VerboseLevel_Info, __VA_ARGS__)
66 #define ABASESDK_ERROR(...) ABASESDK_MESSAGE(VerboseLevel_Error, __VA_ARGS__)
67 #define ABASESDK_WARNING(...) ABASESDK_MESSAGE(VerboseLevel_Warning, __VA_ARGS__)
68 #define ABASESDK_TRACE(...) ABASESDK_MESSAGE(VerboseLevel_Trace, __VA_ARGS__)
69 
70 } } } // namespace artec::sdk::base
71 
72 #else
73 
74 #define ABASESDK_MESSAGE(severity, ...) {}
75 #define ABASESDK_INFO(...) {}
76 #define ABASESDK_ERROR(...) {}
77 #define ABASESDK_WARNING(...) {}
78 #define ABASESDK_TRACE(...) {}
79 
80 #endif
81 
82 #endif // _ABASESDK_LOG_H_
Output errors and warnings.
Definition: Log.h:32
int ABASESDK_LINK_SPEC getOutputLevel()
Comprehensive output.
Definition: Log.h:34
int(* REPORT_HOOK)(int, const wchar_t *)
Definition: Log.h:22
bool ABASESDK_LINK_SPEC setReportHook(int mode, REPORT_HOOK newHook)
Output errors, warnings and information.
Definition: Log.h:33
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
VerboseLevel
The level of detail of verbose output.
Definition: Log.h:28
#define ABASESDK_LINK_SPEC
const int RPTHOOK_REMOVE
Definition: Log.h:25
void ABASESDK_LINK_SPEC setOutputLevel(int mode)