![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2007 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtDebugLog.h,v $ $Revision: 1.21 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #pragma once 00014 #include <vrvUtil/vrvUtil.h> 00015 #include <vlutil/vlExceptions.h> 00016 #include <ostream> 00017 00018 class DtOutputStream; 00019 00020 namespace makVrv 00021 { 00022 #define DT_LOG_WARN log().out(DtDebugLog::Warning)<<"<Warning:"<<__DtFUNC__<<">"<<std::endl 00023 #define DT_LOG_INFO log().out(DtDebugLog::Information)<<"<Info:"<<__DtFUNC__<<">"<<std::endl 00024 #define DT_LOG_DEBUG log().out(DtDebugLog::Debug)<<"<Debug:"<<__DtFUNC__<<">"<<std::endl 00025 #define DT_LOG_OUT log().out() 00026 #define DT_LOG_LEVEL(a) log().levelWillPrint(a) 00027 00030 class DT_DLL_VRVUTIL DtDebugLog 00031 { 00032 public: 00033 00034 enum PrintLevel 00035 { 00036 Warning = 1, 00037 Information = 2, 00038 Debug = 4, 00039 PrintLevel_End = 5 00040 }; 00041 00043 DtDebugLog(DtOutputStream* output); 00044 00046 virtual ~DtDebugLog(); 00047 00050 inline bool levelWillPrint(DtDebugLog::PrintLevel alevel) 00051 { 00052 return level() >= alevel; 00053 } 00054 00056 virtual void setLevel(DtDebugLog::PrintLevel alevel); 00057 00059 virtual DtDebugLog::PrintLevel level(); 00060 00062 inline std::ostream& out(DtDebugLog::PrintLevel level = DtDebugLog::Information) 00063 { 00064 if(levelWillPrint(level)) 00065 return *myOutput; 00066 else 00067 return *myEmptyOutput; 00068 } 00069 00071 DtOutputStream* outputStream(); 00072 00073 protected: 00074 PrintLevel myLevel; 00075 std::ostream* myOutput; 00076 int myRef; 00077 std::ostream* myEmptyOutput; 00078 }; 00079 }