Category.hpp
Go to the documentation of this file.
1 #ifndef CATEGORY_HPP
2 #define CATEGORY_HPP 1
3 
4 #include <log4cpp/Category.hh>
5 #include "LoggingEvent.hpp"
6 #include "CategoryStream.hpp"
7 #include <rtt/Port.hpp>
8 
9 // forward declare
10 namespace RTT {
11  class ConnPolicy;
12 }
13 
14 namespace OCL {
15 namespace logging {
16 
17 // forward declare
18 class LoggingService;
19 
26 {
27 public:
28  virtual ~Category();
29 
30  // custom real-time versions - available to user
31  // these replace std::string versions in the base class
32 public:
33  virtual void log(log4cpp::Priority::Value priority,
34  const RTT::rt_string& message) throw();
35  void debug(const RTT::rt_string& message) throw();
36  void info(const RTT::rt_string& message) throw();
37  void notice(const RTT::rt_string& message) throw();
38  void warn(const RTT::rt_string& message) throw();
39  void error(const RTT::rt_string& message) throw();
40  void crit(const RTT::rt_string& message) throw();
41  void alert(const RTT::rt_string& message) throw();
42  void emerg(const RTT::rt_string& message) throw();
43  void fatal(const RTT::rt_string& message) throw();
44 
49  CategoryStream getRTStream(log4cpp::Priority::Value priority);
50 
51 protected:
52  void _logUnconditionally2(log4cpp::Priority::Value priority,
53  const RTT::rt_string& message) throw();
54 
55 
56  // real-time - available to user
57 public:
62 
66 
76 
77 
78  // real-time (but uses locking) - available to user but BEWARE locking!
79 public:
81 
82 
83 
84  // NOT real-time and so _NOT_ available to user
85 protected:
94 
99 
101 
111  using log4cpp::Category::operator<<;
112 
114 
126 
129 
130 
131 protected:
132  Category(const std::string& name,
133  log4cpp::Category* parent,
135 
136 protected:
141  virtual void callAppenders(const OCL::logging::LoggingEvent& event) throw();
142 
147  static std::string convertName(const std::string& name);
148 
149 public:
155  static log4cpp::Category* createOCLCategory(const std::string& name,
156  log4cpp::Category* parent,
157  log4cpp::Priority::Value priority);
158 
159 
160 protected:
161 //protected:
165 public:
167  {
168  return log_port;
169  };
170 
171 public:
177  bool connectToLogPort(RTT::base::PortInterface& otherPort);
183  bool connectToLogPort(RTT::base::PortInterface& otherPort,
184  RTT::ConnPolicy& cp);
185 
186 private:
187  /* prevent copying and assignment */
188  Category(const Category& other);
189  Category& operator=(const Category& other);
190 };
191 
192 // namespaces
193 }
194 }
195 
196 #endif
bool isEmergEnabled() const
A mirror of log4cpp::LoggingEvent, except using real-time capable strings.
RTT::OutputPort< OCL::logging::LoggingEvent > log_port
Definition: Category.hpp:162
void notice(const char *stringFormat,...)
CategoryStream warnStream()
virtual void callAppenders(const LoggingEvent &event)
virtual AppenderSet getAllAppenders() const
CategoryStream debugStream()
bool isDebugEnabled() const
void debug(const char *stringFormat,...)
void fatal(const char *stringFormat,...)
virtual Category * getParent()
std::basic_string< char, std::char_traits< char >, RTT::os::rt_allocator< char > > rt_string
void warn(const char *stringFormat,...)
static Priority::Value getRootPriority()
virtual Appender * getAppender() const
virtual void setAdditivity(bool additivity)
virtual void log(Priority::Value priority, const char *stringFormat,...)
bool isWarnEnabled() const
static Category & getInstance(const std::string &name)
CategoryStream infoStream()
const RTT::OutputPort< OCL::logging::LoggingEvent > & get_log_port() const
Definition: Category.hpp:166
static void shutdown()
void crit(const char *stringFormat,...)
virtual Priority::Value getChainedPriority() const
void setAppender(Appender *appender)
bool isNoticeEnabled() const
virtual void logva(Priority::Value priority, const char *stringFormat, va_list va)
static void setRootPriority(Priority::Value priority)
virtual void removeAllAppenders()
bool isErrorEnabled() const
static Category & getRoot()
CategoryStream fatalStream()
virtual const std::string & getName() const
virtual void removeAppender(Appender *appender)
rt_allocator< U > other
virtual void _logUnconditionally(Priority::Value priority, const char *format, va_list arguments)
virtual bool getAdditivity() const
virtual Priority::Value getPriority() const
virtual void setPriority(Priority::Value priority)
CategoryStream critStream()
virtual bool isPriorityEnabled(Priority::Value priority) const
CategoryStream errorStream()
static std::vector< Category * > * getCurrentCategories()
CategoryStream noticeStream()
void alert(const char *stringFormat,...)
void info(const char *stringFormat,...)
static Category * exists(const std::string &name)
virtual void addAppender(Appender *appender)
virtual CategoryStream getStream(Priority::Value priority)
void error(const char *stringFormat,...)
bool isInfoEnabled() const
bool isCritEnabled() const
static Logger & log()
void emerg(const char *stringFormat,...)
bool isFatalEnabled() const
class OCL_API Category
virtual void _logUnconditionally2(Priority::Value priority, const std::string &message)
bool isAlertEnabled() const
CategoryStream emergStream()


ocl
Author(s): OCL Development Team
autogenerated on Wed Jun 26 2019 19:26:27