47 #ifndef _MIRA_LOGCUSTOMIZABLEFORMATTER_H_ 48 #define _MIRA_LOGCUSTOMIZABLEFORMATTER_H_ 51 #include <boost/date_time/local_time/local_time.hpp> 99 virtual void format(
const LogRecord& record, std::ostringstream& ioStream) = 0;
105 template<
typename T>
129 Time(
const std::string& iFormat = boost::local_time::local_time_facet::default_time_format)
131 using namespace boost::posix_time;
137 timeFacet.reset(
new time_facet(iFormat.c_str(),
138 time_facet::period_formatter_type(),
139 time_facet::special_values_formatter_type(),
140 time_facet::date_gen_formatter_type(), 1));
145 std::ostringstream s;
151 s.imbue(std::locale(s.getloc(),
timeFacet.get()));
156 boost::shared_ptr<boost::posix_time::time_facet>
timeFacet;
169 Uptime(
const std::string& iFormat = boost::local_time::local_time_facet::default_time_duration_format)
171 using namespace boost::posix_time;
177 timeFacet.reset(
new time_facet(iFormat.c_str(),
178 time_facet::period_formatter_type(),
179 time_facet::special_values_formatter_type(),
180 time_facet::date_gen_formatter_type(), 1));
181 timeFacet->time_duration_format(iFormat.c_str());
186 std::ostringstream s;
192 s.imbue(std::locale(s.getloc(),
timeFacet.get()));
197 boost::shared_ptr<boost::posix_time::time_facet>
timeFacet;
208 ioStream << record.
line;
220 ioStream << record.
file;
232 ioStream <<
MIRA_LOGGER.parseFunction(record).functionName;
244 stream <<
MIRA_LOGGER.parseFunction(record).className;
256 ioStream <<
MIRA_LOGGER.parseFunction(record).nameSpace;
298 std::ostringstream s;
299 for (
size_t i = 0; i <
mFormatter.size(); ++i)
306 mFormatter.push_back(boost::shared_ptr<LogCustomizableFormatter::CustomFormatBase>(
313 mFormatter.push_back(boost::shared_ptr<LogCustomizableFormatter::CustomFormatBase>(
321 mFormatter.push_back(boost::shared_ptr<LogCustomizableFormatter::CustomFormatBase>(
new T(f)));
326 std::vector<boost::shared_ptr<LogCustomizableFormatter::CustomFormatBase> >
mFormatter;
SeverityLevel level
Definition: LoggingCore.h:109
Holds all the information about a log entry.
Definition: LoggingCore.h:107
Duration uptime
Definition: LoggingCore.h:111
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
int line
Definition: LoggingCore.h:114
std::string file
Definition: LoggingCore.h:115
Core class of the logging library.
std::string message
Definition: LoggingCore.h:112
ThreadID threadID
Definition: LoggingCore.h:117
const std::string severityLevelStr[]
String conversion for the enum severity types.
Definition: LoggingCore.h:85
Time time
Definition: LoggingCore.h:110
#define MIRA_LOGGER
Macro for easier access to the logging core instance.
Definition: LoggingCore.h:417