46#if (CISST_OS == CISST_QNX)
84 #undef CMN_LOG_CLASS_INSTANCE
85 #define CMN_LOG_CLASS_INSTANCE(objectPointer, lod) std::cout
89 #define CMN_LOG_CLASS_INSTANCE(objectPointer, lod) \
90if (!(cmnLogger::GetMask() & objectPointer->Services()->GetLogMask() & lod)) ; else \
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)
150 #define CMN_LOG(lod) std::cout
154 #define CMN_LOG(lod) \
155 if (!(cmnLogger::GetMask() & cmnLogger::GetMaskFunction() & lod)) ; else \
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__ << " - "
281 static std::string DefaultLogFileName;
284 static bool InstanceCreated;
296 void SetMaskFunctionInstance(
cmnLogMask mask);
307 std::ofstream * DefaultLogFile(
const std::string & defaultLogFileName = DefaultLogFileName);
310 void HaltDefaultLogInstance(
void);
313 void ResumeDefaultLogInstance(
cmnLogMask newMask);
316 void AddChannelInstance(std::ostream & outputStream,
cmnLogMask mask);
319 void RemoveChannelInstance(std::ostream & outputStream);
322 void KillInstance(
void);
327 cmnLogger(
const std::string & defaultLogFileName = DefaultLogFileName);
354 return Instance()->GetMaskInstance();
358 return Instance()->GetMaskInstance();
366 Instance()->SetMaskFunctionInstance(mask);
374 return Instance()->GetMaskFunctionInstance();
421 return Instance()->GetMultiplexerInstance();
429 Instance()->HaltDefaultLogInstance();
439 Instance()->ResumeDefaultLogInstance(newLoD);
446 Instance()->HaltDefaultLogInstance();
447 Instance()->ResumeDefaultLogInstance(newLoD);
457 Instance()->AddChannelInstance(outputStream, mask);
464 Instance()->AddChannelInstance(std::cout, mask);
470 Instance()->AddChannelInstance(std::cerr, mask);
474 Instance()->RemoveChannelInstance(outputStream);
481 static inline void Kill(
void) {
A Streambuffer class that allows output to multiple streambuf objects for Level of Detail information...
Definition cmnLODMultiplexerStreambuf.h:109
static bool IsCreated()
Definition cmnLogger.h:494
static void SetMaskDefaultLog(cmnLogMask newLoD=CMN_LOG_ALLOW_DEFAULT)
Definition cmnLogger.h:445
static void AddChannelToStdOut(cmnLogMask mask=CMN_LOG_ALLOW_ERRORS_AND_WARNINGS)
Definition cmnLogger.h:463
static StreamBufType * GetMultiplexer(void)
Definition cmnLogger.h:420
cmnLogger(const std::string &defaultLogFileName=DefaultLogFileName)
static void RemoveChannel(std::ostream &outputStream)
Definition cmnLogger.h:473
cmnLODMultiplexerStreambuf< char > StreamBufType
Definition cmnLogger.h:246
static bool SetMaskClassAll(cmnLogMask mask)
static const char * ExtractFileName(const char *file)
static cmnLogMask GetMask(void)
Definition cmnLogger.h:353
static void AddChannelToStdErr(cmnLogMask mask=CMN_LOG_ALLOW_ERRORS_AND_WARNINGS)
Definition cmnLogger.h:469
static void Kill(void)
Definition cmnLogger.h:481
static void AddChannel(std::ostream &outputStream, cmnLogMask mask=CMN_LOG_ALLOW_ALL)
Definition cmnLogger.h:455
static void SetMask(cmnLogMask mask)
Definition cmnLogger.h:342
static cmnLogMask CISST_DEPRECATED GetLoD(void)
Definition cmnLogger.h:357
static bool SetDefaultLogFileName(const std::string &defaultLogFileName)
static std::string GetDefaultLogFileName(void)
Definition cmnLogger.h:491
static bool SetMaskClass(const std::string &className, cmnLogMask mask)
static void HaltDefaultLog(void)
Definition cmnLogger.h:428
static cmnLogMask GetMaskFunction(void)
Definition cmnLogger.h:373
static cmnLogger * Instance(void)
static void ResumeDefaultLog(cmnLogMask newLoD=CMN_LOG_ALLOW_DEFAULT)
Definition cmnLogger.h:438
static bool SetMaskClassMatching(const std::string &stringToMatch, cmnLogMask mask)
static void CISST_DEPRECATED SetLoD(cmnLogMask mask)
Definition cmnLogger.h:346
static void SetMaskFunction(cmnLogMask mask)
Definition cmnLogger.h:365
Macros to export the symbols of cisstCommon (in a Dll).
#define CISST_EXPORT
Definition cmnExportMacros.h:50
Type Definitions for dynamic control of output messages.
Types for dynamic control of output messages.
Declaration of Levels of Detail for cmnLogger (human readable logging).
#define CMN_LOG_ALLOW_ERRORS_AND_WARNINGS
Definition cmnLogLoD.h:72
short cmnLogMask
Definition cmnLogLoD.h:67
#define CMN_LOG_ALLOW_DEFAULT
Definition cmnLogLoD.h:76
#define CMN_LOG_ALLOW_ALL
Definition cmnLogLoD.h:75
Types for dynamic control of output messages.
Portability across compilers and operating systems tools.
#define CISST_DEPRECATED
Definition cmnPortability.h:314