00001 // 00002 // Copyright (C) 2005-2008 Greg Landrum and Rational Discovery LLC 00003 // 00004 // @@ All Rights Reserved @@ 00005 // This file is part of the RDKit. 00006 // The contents are covered by the terms of the BSD license 00007 // which is included in the file license.txt, found at the root 00008 // of the RDKit source tree. 00009 // 00010 00011 #ifndef _RDLOG_H_29JUNE2005_ 00012 #define _RDLOG_H_29JUNE2005_ 00013 00014 #if 1 00015 #include <iostream> 00016 namespace boost { 00017 namespace logging { 00018 class rdLogger{ 00019 public: 00020 rdLogger(std::ostream *dest,bool owner=false) : dp_dest(dest), df_owner(owner), 00021 df_enabled(true) {}; 00022 std::ostream *dp_dest; 00023 bool df_owner,df_enabled; 00024 ~rdLogger(){ 00025 if(dp_dest){ 00026 dp_dest->flush(); 00027 if(df_owner){ 00028 delete dp_dest; 00029 } 00030 } 00031 } 00032 }; 00033 void enable_logs(const char *arg); 00034 void enable_logs(const std::string &arg); 00035 void disable_logs(const char *arg); 00036 void disable_logs(const std::string &arg); 00037 } 00038 } 00039 namespace RDLog { 00040 std::ostream &toStream(std::ostream &); 00041 } 00042 #define BOOST_LOG(__arg__) if((!__arg__)||(!__arg__->dp_dest)||!(__arg__->df_enabled)) ; else RDLog::toStream(*(__arg__->dp_dest)) 00043 00044 00045 extern boost::logging::rdLogger *rdAppLog; 00046 extern boost::logging::rdLogger *rdDebugLog; 00047 extern boost::logging::rdLogger *rdInfoLog; 00048 extern boost::logging::rdLogger *rdErrorLog; 00049 extern boost::logging::rdLogger *rdWarningLog; 00050 extern boost::logging::rdLogger *rdStatusLog; 00051 00052 00053 #else 00054 #define BOOST_LOG_NO_LIB 00055 #include <boost/log/log.hpp> 00056 BOOST_DECLARE_LOG(rdAppLog) 00057 BOOST_DECLARE_LOG(rdDebugLog) 00058 BOOST_DECLARE_LOG(rdInfoLog) 00059 BOOST_DECLARE_LOG(rdErrorLog) 00060 BOOST_DECLARE_LOG(rdWarningLog) 00061 BOOST_DECLARE_LOG(rdStatusLog) 00062 #endif 00063 namespace RDLog { 00064 void InitLogs(); 00065 } 00066 #endif 00067
1.7.1