46 #if (CISST_OS == CISST_QNX)
47 #define BYPASS_CMN_LOG
84 #undef CMN_LOG_CLASS_INSTANCE
85 #define CMN_LOG_CLASS_INSTANCE(objectPointer, lod) std::cout
89 #define CMN_LOG_CLASS_INSTANCE(objectPointer, lod) \
90 if (cmnLogger::GetMask() & objectPointer->Services()->GetLogMask() & lod) \
91 ((cmnLODOutputMultiplexer(objectPointer->GetLogMultiplexer(), lod).Ref()) << cmnLogLevelToString(lod) << " Class " << objectPointer->Services()->GetName() << ": ")
95 #define CMN_LOG_CLASS(lod) CMN_LOG_CLASS_INSTANCE(this, lod)
100 #define CMN_LOG_CLASS_INSTANCE_INIT_ERROR(objectPointer) CMN_LOG_CLASS_INSTANCE(objectPointer, CMN_LOG_LEVEL_INIT_ERROR) << CMN_LOG_DETAILS << " "
101 #define CMN_LOG_CLASS_INSTANCE_INIT_WARNING(objectPointer) CMN_LOG_CLASS_INSTANCE(objectPointer, CMN_LOG_LEVEL_INIT_WARNING)
102 #define CMN_LOG_CLASS_INSTANCE_INIT_VERBOSE(objectPointer) CMN_LOG_CLASS_INSTANCE(objectPointer, CMN_LOG_LEVEL_INIT_VERBOSE)
103 #define CMN_LOG_CLASS_INSTANCE_INIT_DEBUG(objectPointer) CMN_LOG_CLASS_INSTANCE(objectPointer, CMN_LOG_LEVEL_INIT_DEBUG)
104 #define CMN_LOG_CLASS_INSTANCE_RUN_ERROR(objectPointer) CMN_LOG_CLASS_INSTANCE(objectPointer, CMN_LOG_LEVEL_RUN_ERROR) << CMN_LOG_DETAILS << " "
105 #define CMN_LOG_CLASS_INSTANCE_RUN_WARNING(objectPointer) CMN_LOG_CLASS_INSTANCE(objectPointer, CMN_LOG_LEVEL_RUN_WARNING)
106 #define CMN_LOG_CLASS_INSTANCE_RUN_VERBOSE(objectPointer) CMN_LOG_CLASS_INSTANCE(objectPointer, CMN_LOG_LEVEL_RUN_VERBOSE)
107 #define CMN_LOG_CLASS_INSTANCE_RUN_DEBUG(objectPointer) CMN_LOG_CLASS_INSTANCE(objectPointer, CMN_LOG_LEVEL_RUN_DEBUG)
113 #define CMN_LOG_CLASS_INIT_ERROR CMN_LOG_CLASS(CMN_LOG_LEVEL_INIT_ERROR) << CMN_LOG_DETAILS << " "
114 #define CMN_LOG_CLASS_INIT_WARNING CMN_LOG_CLASS(CMN_LOG_LEVEL_INIT_WARNING)
115 #define CMN_LOG_CLASS_INIT_VERBOSE CMN_LOG_CLASS(CMN_LOG_LEVEL_INIT_VERBOSE)
116 #define CMN_LOG_CLASS_INIT_DEBUG CMN_LOG_CLASS(CMN_LOG_LEVEL_INIT_DEBUG)
117 #define CMN_LOG_CLASS_RUN_ERROR CMN_LOG_CLASS(CMN_LOG_LEVEL_RUN_ERROR) << CMN_LOG_DETAILS << " "
118 #define CMN_LOG_CLASS_RUN_WARNING CMN_LOG_CLASS(CMN_LOG_LEVEL_RUN_WARNING)
119 #define CMN_LOG_CLASS_RUN_VERBOSE CMN_LOG_CLASS(CMN_LOG_LEVEL_RUN_VERBOSE)
120 #define CMN_LOG_CLASS_RUN_DEBUG CMN_LOG_CLASS(CMN_LOG_LEVEL_RUN_DEBUG)
147 #ifdef BYPASS_CMN_LOG
150 #define CMN_LOG(lod) std::cout
154 #define CMN_LOG(lod) \
155 if (cmnLogger::GetMask() & cmnLogger::GetMaskFunction() & lod) \
156 ((cmnLODOutputMultiplexer(cmnLogger::GetMultiplexer(), lod).Ref()) << cmnLogLevelToString(lod) << " ")
162 #define CMN_LOG_INIT_ERROR CMN_LOG(CMN_LOG_LEVEL_INIT_ERROR) << CMN_LOG_DETAILS << " "
163 #define CMN_LOG_INIT_WARNING CMN_LOG(CMN_LOG_LEVEL_INIT_WARNING)
164 #define CMN_LOG_INIT_VERBOSE CMN_LOG(CMN_LOG_LEVEL_INIT_VERBOSE)
165 #define CMN_LOG_INIT_DEBUG CMN_LOG(CMN_LOG_LEVEL_INIT_DEBUG)
166 #define CMN_LOG_RUN_ERROR CMN_LOG(CMN_LOG_LEVEL_RUN_ERROR) << CMN_LOG_DETAILS << " "
167 #define CMN_LOG_RUN_WARNING CMN_LOG(CMN_LOG_LEVEL_RUN_WARNING)
168 #define CMN_LOG_RUN_VERBOSE CMN_LOG(CMN_LOG_LEVEL_RUN_VERBOSE)
169 #define CMN_LOG_RUN_DEBUG CMN_LOG(CMN_LOG_LEVEL_RUN_DEBUG)
186 #define CMN_LOG_DETAILS \
187 "File: " << cmnLogger::ExtractFileName(__FILE__) << " Line: " << __LINE__ << " - "
289 void SetMaskFunctionInstance(
cmnLogMask mask);
300 std::ofstream * DefaultLogFile(
const std::string & defaultLogFileName =
"cisstLog.txt");
303 void HaltDefaultLogInstance(
void);
306 void ResumeDefaultLogInstance(
cmnLogMask newMask);
309 void AddChannelInstance(std::ostream & outputStream,
cmnLogMask mask);
312 void RemoveChannelInstance(std::ostream & outputStream);
315 void KillInstance(
void);
320 cmnLogger(
const std::string & defaultLogFileName =
"cisstLog.txt");
336 Instance()->SetMaskInstance(mask);
340 Instance()->SetMaskInstance(mask);
347 return Instance()->GetMaskInstance();
351 return Instance()->GetMaskInstance();
359 Instance()->SetMaskFunctionInstance(mask);
367 return Instance()->GetMaskFunctionInstance();
379 static bool SetMaskClass(
const std::string & className,
cmnLogMask mask);
402 static bool SetMaskClassMatching(
const std::string & stringToMatch,
cmnLogMask mask);
414 return Instance()->GetMultiplexerInstance();
422 Instance()->HaltDefaultLogInstance();
432 Instance()->ResumeDefaultLogInstance(newLoD);
439 Instance()->HaltDefaultLogInstance();
440 Instance()->ResumeDefaultLogInstance(newLoD);
450 Instance()->AddChannelInstance(outputStream, mask);
457 Instance()->AddChannelInstance(std::cout, mask);
463 Instance()->AddChannelInstance(std::cerr, mask);
467 Instance()->RemoveChannelInstance(outputStream);
470 static const char * ExtractFileName(
const char * file);
474 static inline void Kill(
void) {
475 Instance()->KillInstance();
481 #endif // _cmnLogger_h
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
static void AddChannelToStdOut(cmnLogMask mask=CMN_LOG_ALLOW_ERRORS_AND_WARNINGS)
Definition: cmnLogger.h:456
static void ResumeDefaultLog(cmnLogMask newLoD=CMN_LOG_ALLOW_DEFAULT)
Definition: cmnLogger.h:431
static void SetMask(cmnLogMask mask)
Definition: cmnLogger.h:335
Types for dynamic control of output messages.
#define CISST_DEPRECATED
Definition: cmnPortability.h:310
static cmnLogMask GetMaskFunction(void)
Definition: cmnLogger.h:366
static void SetMaskFunction(cmnLogMask mask)
Definition: cmnLogger.h:358
Portability across compilers and operating systems tools.
static void AddChannel(std::ostream &outputStream, cmnLogMask mask=CMN_LOG_ALLOW_ALL)
Definition: cmnLogger.h:448
Declaration of Levels of Detail for cmnLogger (human readable logging)
Class to glue the class register, the output multiplexer and the message level of detail to form the ...
Definition: cmnLogger.h:242
static void AddChannelToStdErr(cmnLogMask mask=CMN_LOG_ALLOW_ERRORS_AND_WARNINGS)
Definition: cmnLogger.h:462
#define CMN_LOG_ALLOW_ERRORS_AND_WARNINGS
Definition: cmnLogLoD.h:72
Macros to export the symbols of cisstCommon (in a Dll).
Type Definitions for dynamic control of output messages.
static StreamBufType * GetMultiplexer(void)
Definition: cmnLogger.h:413
short cmnLogMask
Definition: cmnLogLoD.h:67
static cmnLogMask CISST_DEPRECATED GetLoD(void)
Definition: cmnLogger.h:350
static void Kill(void)
Definition: cmnLogger.h:474
static void RemoveChannel(std::ostream &outputStream)
Definition: cmnLogger.h:466
static void CISST_DEPRECATED SetLoD(cmnLogMask mask)
Definition: cmnLogger.h:339
static void HaltDefaultLog(void)
Definition: cmnLogger.h:421
#define CMN_LOG_ALLOW_ALL
Definition: cmnLogLoD.h:75
Types for dynamic control of output messages.
#define CMN_LOG_ALLOW_DEFAULT
Definition: cmnLogLoD.h:76
static void SetMaskDefaultLog(cmnLogMask newLoD=CMN_LOG_ALLOW_DEFAULT)
Definition: cmnLogger.h:438
static cmnLogMask GetMask(void)
Definition: cmnLogger.h:346
cmnLODMultiplexerStreambuf< char > StreamBufType
Definition: cmnLogger.h:246