void LogDockAppender::append(const spi::LoggingEventPtr& event, Pool& p) {
log4cxx::LogString message, timestamp;
- if ( this->layout == NULL ) {
- LOG4CXX_ENCODE_CHAR(nameStr, name);
- std::string msg("No Layout set for the appender named [ ");
- msg.append(nameStr);
- msg.append(" ].");
-
- LOG4CXX_DECODE_CHAR(msgL, msg);
- errorHandler->error(msgL);
- return;
- }
-
- layout->format(message, event, p);
- timeformat.format(timestamp, event->getTimeStamp(), p);
- LOG4CXX_ENCODE_CHAR(messageencode, message);
- LOG4CXX_ENCODE_CHAR(timestampencode, timestamp);
-
- int rowcount = target->rowCount();
- target->insertRow(rowcount);
- target->setItem(rowcount, 0, new QTableWidgetItem(timestampencode.c_str()));
- target->setItem(rowcount, 1, new QTableWidgetItem(event->getLevel()->toString().c_str()));
- target->setItem(rowcount, 2, new QTableWidgetItem(messageencode.c_str()));
- target->resizeColumnsToContents();
+ if ( this->layout == NULL ) {
+ LOG4CXX_ENCODE_CHAR(nameStr, name);
+ std::string msg("No Layout set for the appender named [ ");
+ msg.append(nameStr);
+ msg.append(" ].");
+
+ LOG4CXX_DECODE_CHAR(msgL, msg);
+ errorHandler->error(msgL);
+ return;
+ }
+
+ layout->format(message, event, p);
+ timeformat.format(timestamp, event->getTimeStamp(), p);
+ LOG4CXX_ENCODE_CHAR(messageencode, message);
+ LOG4CXX_ENCODE_CHAR(timestampencode, timestamp);
+
+ QColor rowcolor(0xff, 0xff, 0xff, 0xff);
+ if (log4cxx::Level::getFatal() == event->getLevel()) {
+ rowcolor.setRgb(0xff, 0x00, 0x22);
+ } else if (log4cxx::Level::getError() == event->getLevel()) {
+ rowcolor.setRgb(0xff, 0x00, 0x00);
+ } else if (log4cxx::Level::getWarn() == event->getLevel()) {
+ rowcolor.setRgb(0x00, 0xff, 0xff);
+ } else if (log4cxx::Level::getTrace() == event->getLevel()) {
+ rowcolor.setRgb(0xee, 0xff, 0xee);
+ }
+
+ int rowcount = target->rowCount();
+ target->insertRow(rowcount);
+ target->setItem(rowcount, 0, new QTableWidgetItem(timestampencode.c_str()));
+ target->setItem(rowcount, 1, new QTableWidgetItem(event->getLevel()->toString().c_str()));
+ target->setItem(rowcount, 2, new QTableWidgetItem(messageencode.c_str()));
+ target->item(rowcount, 0)->setBackground(rowcolor);
+ target->item(rowcount, 1)->setBackground(rowcolor);
+ target->item(rowcount, 2)->setBackground(rowcolor);
+ target->resizeColumnsToContents();
}
void LogDockAppender::setTarget(LogDock *target) {