00001 #ifndef CATEGORY_HPP
00002 #define CATEGORY_HPP 1
00003
00004 #include <log4cpp/Category.hh>
00005 #include "LoggingEvent.hpp"
00006 #include "CategoryStream.hpp"
00007 #include <rtt/Port.hpp>
00008
00009 namespace OCL {
00010 namespace logging {
00011
00012
00013 class LoggingService;
00014
00019 class Category : public log4cpp::Category
00020 {
00021 public:
00022 virtual ~Category();
00023
00024
00025
00026 public:
00027 virtual void log(log4cpp::Priority::Value priority,
00028 const RTT::rt_string& message) throw();
00029 void debug(const RTT::rt_string& message) throw();
00030 void info(const RTT::rt_string& message) throw();
00031 void notice(const RTT::rt_string& message) throw();
00032 void warn(const RTT::rt_string& message) throw();
00033 void error(const RTT::rt_string& message) throw();
00034 void crit(const RTT::rt_string& message) throw();
00035 void alert(const RTT::rt_string& message) throw();
00036 void emerg(const RTT::rt_string& message) throw();
00037 void fatal(const RTT::rt_string& message) throw();
00038
00039 CategoryStream getRTStream(log4cpp::Priority::Value priority);
00040
00041 protected:
00042 void _logUnconditionally2(log4cpp::Priority::Value priority,
00043 const RTT::rt_string& message) throw();
00044
00045
00046
00047 public:
00048 using log4cpp::Category::setPriority;
00049 using log4cpp::Category::getPriority;
00050 using log4cpp::Category::getChainedPriority;
00051 using log4cpp::Category::isPriorityEnabled;
00052
00053 using log4cpp::Category::setAdditivity;
00054 using log4cpp::Category::getAdditivity;
00055 using log4cpp::Category::getParent;
00056
00057 using log4cpp::Category::isDebugEnabled;
00058 using log4cpp::Category::isInfoEnabled;
00059 using log4cpp::Category::isNoticeEnabled;
00060 using log4cpp::Category::isWarnEnabled;
00061 using log4cpp::Category::isErrorEnabled;
00062 using log4cpp::Category::isCritEnabled;
00063 using log4cpp::Category::isAlertEnabled;
00064 using log4cpp::Category::isEmergEnabled;
00065 using log4cpp::Category::isFatalEnabled;
00066
00067
00068
00069 public:
00070 using log4cpp::Category::getAppender;
00071
00072
00073
00074
00075 protected:
00076 using log4cpp::Category::getRoot;
00077 using log4cpp::Category::setRootPriority;
00078 using log4cpp::Category::getRootPriority;
00079 using log4cpp::Category::getInstance;
00080 using log4cpp::Category::exists;
00081 using log4cpp::Category::getCurrentCategories;
00082 using log4cpp::Category::shutdown;
00083 using log4cpp::Category::getName;
00084
00085 using log4cpp::Category::removeAllAppenders;
00086 using log4cpp::Category::removeAppender;
00087 using log4cpp::Category::addAppender;
00088 using log4cpp::Category::setAppender;
00089
00090 using log4cpp::Category::getAllAppenders;
00091
00092 using log4cpp::Category::debugStream;
00093 using log4cpp::Category::infoStream;
00094 using log4cpp::Category::noticeStream;
00095 using log4cpp::Category::warnStream;
00096 using log4cpp::Category::errorStream;
00097 using log4cpp::Category::critStream;
00098 using log4cpp::Category::emergStream;
00099 using log4cpp::Category::fatalStream;
00100 using log4cpp::Category::getStream;
00101 using log4cpp::Category::operator<<;
00102
00103 using log4cpp::Category::callAppenders;
00104
00105 using log4cpp::Category::log;
00106 using log4cpp::Category::logva;
00107 using log4cpp::Category::debug;
00108 using log4cpp::Category::info;
00109 using log4cpp::Category::notice;
00110 using log4cpp::Category::warn;
00111 using log4cpp::Category::error;
00112 using log4cpp::Category::crit;
00113 using log4cpp::Category::alert;
00114 using log4cpp::Category::emerg;
00115 using log4cpp::Category::fatal;
00116
00117 using log4cpp::Category::_logUnconditionally;
00118 using log4cpp::Category::_logUnconditionally2;
00119
00120
00121 protected:
00122 Category(const std::string& name,
00123 log4cpp::Category* parent,
00124 log4cpp::Priority::Value priority = log4cpp::Priority::NOTSET);
00125
00126 protected:
00131 virtual void callAppenders(const OCL::logging::LoggingEvent& event) throw();
00132
00137 static std::string convertName(const std::string& name);
00138
00139 public:
00145 static log4cpp::Category* createOCLCategory(const std::string& name,
00146 log4cpp::Category* parent,
00147 log4cpp::Priority::Value priority);
00148
00149
00150 protected:
00151
00152 RTT::OutputPort<OCL::logging::LoggingEvent> log_port;
00154 friend class OCL::logging::LoggingService;
00155
00156 private:
00157
00158 Category(const Category& other);
00159 Category& operator=(const Category& other);
00160 };
00161
00162
00163 }
00164 }
00165
00166 #endif