00001 //----------------------------------------------------------- 00002 // Copyright Christian Arnault LAL-Orsay CNRS 00003 // arnault@lal.in2p3.fr 00004 // See the complete license in cmt_license.txt "http://www.cecill.info". 00005 //----------------------------------------------------------- 00006 00007 #ifndef __cmt_log_h__ 00008 #define __cmt_log_h__ 00009 00010 #include "cmt_string.h" 00011 00012 class CmtLogEnd 00013 { 00014 public: 00015 }; 00016 00017 class CmtLogDummy 00018 { 00019 public: 00020 }; 00021 00022 class CmtLog 00023 { 00024 public: 00025 CmtLog (); 00026 00027 static CmtLogEnd& end (); 00028 CmtLog& operator << (const cmt_string& s); 00029 CmtLog& operator << (const char* c); 00030 CmtLog& operator << (int i); 00031 CmtLog& operator << (double d); 00032 CmtLog& operator << (void* p); 00033 CmtLog& operator << (CmtLogEnd& end); 00034 CmtLog& operator << (CmtLogDummy& dummy); 00035 00036 private: 00037 bool check (); 00038 }; 00039 00040 #define Log static CmtLog log_instance 00041 #define log_endl CmtLog::end () 00042 #define log if (Cmt::get_debug ()) log_instance << "#CMT> (" << __FILE__ << "-" << __LINE__ << ") " 00043 #define log_cont if (Cmt::get_debug ()) log_instance 00044 00045 #endif