LoggingEvent.cpp
Go to the documentation of this file.
00001 #include "LoggingEvent.hpp"
00002 #include <log4cpp/Priority.hh>
00003 #include <log4cpp/threading/Threading.hh>
00004 #include <cstdio>
00005 
00006 using namespace RTT;
00007 
00008 namespace OCL {
00009 namespace logging {
00010     
00011 LoggingEvent::LoggingEvent() :
00012         categoryName(""),
00013         message(""),
00014         ndc(""),
00015         priority(log4cpp::Priority::NOTSET),
00016         threadName(""),
00017         timeStamp()
00018 {
00019 }
00020 
00021 LoggingEvent::LoggingEvent(const LoggingEvent& toCopy) :
00022         categoryName(toCopy.categoryName),
00023         message(toCopy.message),
00024         ndc(toCopy.ndc),
00025         priority(toCopy.priority),
00026         threadName(toCopy.threadName),
00027         timeStamp(toCopy.timeStamp)
00028 {
00029 }
00030 
00031 LoggingEvent::LoggingEvent(const rt_string& categoryName, 
00032                            const rt_string& message,
00033                            const rt_string& ndc, 
00034                            log4cpp::Priority::Value priority) :
00035         categoryName(categoryName),
00036         message(message),
00037         ndc(ndc),
00038         priority(priority),
00039         threadName(""),
00040         timeStamp()
00041 {
00042     char    buffer[16];
00043     threadName = log4cpp::threading::getThreadId(&buffer[0]);
00044 }
00045 
00046 const LoggingEvent& LoggingEvent::operator=(const LoggingEvent& rhs)
00047 {
00048     if (&rhs != this)   // prevent self-copy
00049     {
00050         categoryName    = rhs.categoryName;
00051         message         = rhs.message;
00052         ndc             = rhs.ndc;
00053         priority        = rhs.priority;
00054         threadName      = rhs.threadName;
00055         timeStamp               = rhs.timeStamp;
00056     }
00057     return *this;
00058 }
00059 
00060 LoggingEvent::~LoggingEvent()
00061 {
00062 }
00063 
00064 log4cpp::LoggingEvent LoggingEvent::toLog4cpp()
00065 {   
00066     return log4cpp::LoggingEvent(makeString(this->categoryName),
00067                                  makeString(this->message),
00068                                  makeString(this->ndc),
00069                                  this->priority,
00070                                  makeString(this->threadName),
00071                                  this->timeStamp);
00072 }
00073         
00074 
00075 // namespaces
00076 }
00077 }


ocl
Author(s): OCL Development Team
autogenerated on Sat Jun 8 2019 18:48:54