RDKit
Open-source cheminformatics and machine learning.
RDLog.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005-2008 Greg Landrum and Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 
11 #ifndef _RDLOG_H_29JUNE2005_
12 #define _RDLOG_H_29JUNE2005_
13 
14 #if 1
15 #include <iostream>
16 namespace boost {
17  namespace logging {
18  class rdLogger{
19  public:
20  rdLogger(std::ostream *dest,bool owner=false) : dp_dest(dest), df_owner(owner),
21  df_enabled(true) {};
22  std::ostream *dp_dest;
25  if(dp_dest){
26  dp_dest->flush();
27  if(df_owner){
28  delete dp_dest;
29  }
30  }
31  }
32  };
33  void enable_logs(const char *arg);
34  void enable_logs(const std::string &arg);
35  void disable_logs(const char *arg);
36  void disable_logs(const std::string &arg);
37  }
38 }
39 namespace RDLog {
40  std::ostream &toStream(std::ostream &);
41 }
42 #define BOOST_LOG(__arg__) if((!__arg__)||(!__arg__->dp_dest)||!(__arg__->df_enabled)) ; else RDLog::toStream(*(__arg__->dp_dest))
43 
44 
51 
52 
53 #else
54 #define BOOST_LOG_NO_LIB
55 #include <boost/log/log.hpp>
56 BOOST_DECLARE_LOG(rdAppLog)
57 BOOST_DECLARE_LOG(rdDebugLog)
58 BOOST_DECLARE_LOG(rdInfoLog)
59 BOOST_DECLARE_LOG(rdErrorLog)
60 BOOST_DECLARE_LOG(rdWarningLog)
61 BOOST_DECLARE_LOG(rdStatusLog)
62 #endif
63 namespace RDLog {
64  void InitLogs();
65 }
66 #endif
67 
Definition: RDLog.h:16
Definition: RDLog.h:39
rdLogger(std::ostream *dest, bool owner=false)
Definition: RDLog.h:20
std::ostream * dp_dest
Definition: RDLog.h:21
void InitLogs()
boost::logging::rdLogger * rdWarningLog
boost::logging::rdLogger * rdAppLog
boost::logging::rdLogger * rdStatusLog
boost::logging::rdLogger * rdDebugLog
std::ostream & toStream(std::ostream &)
boost::logging::rdLogger * rdInfoLog
void enable_logs(const char *arg)
boost::logging::rdLogger * rdErrorLog
void disable_logs(const char *arg)