00001
00002
00003
00004
00005
00006
00007
00008 #ifndef BRICS_OODL_LOGGER_HPP
00009 #define BRICS_OODL_LOGGER_HPP
00010
00011 #include <iostream>
00012
00013
00014 #ifdef BOOST_LOG_FOUND
00015 #include <boost/log/utility/init/to_console.hpp>
00016 #include <boost/log/utility/init/to_file.hpp>
00017 #include <boost/log/utility/init/common_attributes.hpp>
00018 #include <boost/log/utility/init/from_stream.hpp>
00019 #include <boost/log/utility/init/common_attributes.hpp>
00020 #include <boost/log/core.hpp>
00021 #include <boost/log/trivial.hpp>
00022 #include <boost/log/filters.hpp>
00023
00024 namespace logging = boost::log;
00025 namespace sinks = boost::log::sinks;
00026 namespace src = boost::log::sources;
00027
00028 namespace attrs = boost::log::attributes;
00029 namespace keywords = boost::log::keywords;
00030
00031 #endif
00032
00033
00034 namespace brics_oodl {
00035
00036 enum severity_level {
00037 trace,
00038 debug,
00039 info,
00040 warning,
00041 oodl_exception,
00042 error,
00043 fatal
00044 };
00045
00046
00047
00048 #ifdef BOOST_LOG_FOUND
00049 static src::severity_logger< brics_oodl::severity_level > severityLogger;
00050 #define LOG(level) BOOST_LOG_STREAM_SEV(severityLogger, level)
00051 #else
00052 #define LOG(level) std::cout
00053 #endif
00054
00055 class Logger {
00056 private:
00057
00058 Logger() {
00059 isInitialized = false;
00060 }
00061
00062 ~Logger() {
00063 }
00064 Logger(const Logger &);
00065 Logger & operator=(const Logger &);
00066
00067 bool isInitialized;
00068 public:
00069 static Logger &getInstance();
00070 void init();
00071 };
00072
00073 }
00074
00075 #endif
00076