4 #include <vrecko/Export>
17 class logger_streambuf;
21 #define LOGGER_OUTPUTTYPE_ERROR 0x00000001
23 #define LOGGER_OUTPUTTYPE_WARNING 0x00000002
25 #define LOGGER_OUTPUTTYPE_NOTICE 0x00000004
27 #define LOGGER_OUTPUTTYPE_DEBUG 0x00000008
29 #define LOGGER_OUTPUTTYPE_DEBUGFILE 0x00000010
31 #define LOGGER_OUTPUTTYPE_DEBUGFLUSH 0x00000020
34 #define LOGGER_OUTPUTTYPE_TIMINGSFILE 0x00000040
37 #define LOGGER_OUTPUTTYPEMASK_ALL 0xFFFFFFFF
38 #define LOGGER_OUTPUTTYPEMASK_NONE 0x00000000
39 #define LOGGER_OUTPUTTYPEMASK_DEBUG LOGGER_OUTPUTTYPEMASK_ALL
40 #define LOGGER_OUTPUTTYPEMASK_USER (LOGGER_OUTPUTTYPE_ERROR | LOGGER_OUTPUTTYPE_WARNING | LOGGER_OUTPUTTYPE_NOTICE)
41 #define LOGGER_OUTPUTTYPEMASK_NORMAL LOGGER_OUTPUTTYPEMASK_USER
43 #define LOGGER_OT_INTERNALMASK_SPECIALTYPES (LOGGER_OUTPUTTYPE_TIMINGSFILE)
44 #define LOGGER_OT_INTERNALMASK_NORMALTYPES (0xFFFFFFFF ^ LOGGER_OT_INTERNALMASK_SPECIALTYPES)
48 #define LOGGER_OUTPUTDEST_STDOUT 0x00000001 // text console
49 #define LOGGER_OUTPUTDEST_FILE 0x00000002 // log file
50 #define LOGGER_OUTPUTDEST_DEBUGSTRING 0x00000004 // i.e. using OutputDebugString() to print it on VisutalStudio console.
52 #define LOGGER_OUTPUTDESTMASK_ALL 0xFFFFFFFF // all output destinations
53 #define LOGGER_OUTPUTDESTMASK_NONE 0x00000000
54 #define LOGGER_OUTPUTDESTMASK_NO_STDOUT (LOGGER_OUTPUTDESTMASK_ALL ^ LOGGER_OUTPUTDEST_STDOUT)
55 #define LOGGER_OUTPUTDESTMASK_NO_FILE (LOGGER_OUTPUTDESTMASK_ALL ^ LOGGER_OUTPUTDEST_FILE)
56 #define LOGGER_OUTPUTDESTMASK_NO_DEBUGSTRING (LOGGER_OUTPUTDESTMASK_ALL ^ LOGGER_OUTPUTDEST_DEBUGSTRING)
76 void noticeLog(
const char *notice =
"", ...);
77 void vnoticeLog(
const char *notice, va_list args);
80 void warningLog(
const char *warning =
"", ...);
81 void vwarningLog(
const char *warning, va_list args);
84 void errorLog(
const char *error =
"", ...);
85 void verrorLog(
const char *error, va_list args);
88 void debugLog(
const char *debugText =
"", ...);
89 void vdebugLog(
const char *debugText, va_list args);
91 void debugFileLog(
const char *debugText =
"", ...);
92 void vdebugFileLog(
const char *debugText, va_list args);
94 void debugFlush(
const char *debugText =
"", ...);
95 void vdebugFlush(
const char *debugText, va_list args);
99 inline void setAllowedOutput(
unsigned long dwNewOutput) { dwAllowedOutput = dwNewOutput; }
104 inline void setOutputDest(
unsigned long dwNewOutputDest) { dwOutputDest = dwNewOutputDest; }
107 void startTiming(std::string sectionName);
112 void writeBMCounter(
const char *pName,
float fValue);
121 typedef void (*OutputNotificationFuncType)(
unsigned long dwOutputType,
const char *outputLine,
void* userParam);
123 bool registerOutputNotification(OutputNotificationFuncType aFunc,
void* userParam);
124 bool unregisterOutputNotification(OutputNotificationFuncType aFunc);
159 void addOutstandingText(
unsigned long dwOutputType,
const char *buffer);
161 void processOutstandingTexts();
164 void writeBMCounterLowLevel(
unsigned int time,
const char *pName,
float fValue);
167 void processOutstandingCounters();
172 void processTextMain(
unsigned long dwOutputType,
const char *buffer);
175 bool openBenchmarkFile();
215 void textLog(
unsigned long dwOutputType,
const char *text =
"", ...);
216 void vtextLog(
unsigned long dwOutputType,
const char *text, va_list args);
224 #define OUTPUTSTR(str) logger.debugLog(str);
225 #define OUTPUTSTR2(str, p1) logger.debugLog((str), (p1));
226 #define OUTPUTSTR3(str, p1, p2) logger.debugLog((str), (p1), (p2));
227 #define OUTPUTSTR4(str, p1, p2, p3) logger.debugLog((str), (p1), (p2), (p3));
228 #define OUTPUTSTR5(str, p1, p2, p3, p4) logger.debugLog((str), (p1), (p2), (p3), (p4));
229 #define OUTPUTSTR6(str, p1, p2, p3, p4, p5) logger.debugLog((str), (p1), (p2), (p3), (p4), (p5));
230 #define OUTPUTSTR7(str, p1, p2, p3, p4, p5, p6) logger.debugLog((str), (p1), (p2), (p3), (p4), (p5), (p6));
232 #define STARTTIMING(sectionName) logger.startTiming(sectionName);
233 #define STOPTIMING(sectionName) logger.stopTiming(sectionName);
235 #define OUTPUTSTR(str) {}
236 #define OUTPUTSTR2(str, p1) {}
237 #define OUTPUTSTR3(str, p1, p2) {}
238 #define OUTPUTSTR4(str, p1, p2, p3) {}
239 #define OUTPUTSTR5(str, p1, p2, p3, p4) {}
240 #define OUTPUTSTR6(str, p1, p2, p3, p4, p5) {}
241 #define OUTPUTSTR7(str, p1, p2, p3, p4, p5, p6) {}
243 #define STARTTIMING(sectionName)
244 #define STOPTIMING(sectionName)