本文整理汇总了C++中LogEntry::file方法的典型用法代码示例。如果您正苦于以下问题:C++ LogEntry::file方法的具体用法?C++ LogEntry::file怎么用?C++ LogEntry::file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogEntry
的用法示例。
在下文中一共展示了LogEntry::file方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print
void StdLogOutput::print(const LogEntry &entry)
{
//const QString timestamp(entry.timestamp().toString("yy-MM-dd::hh:mm:ss"));
const QString timestamp(entry.timestamp().toString("hh:mm:ss"));
switch(entry.type())
{
case LogEntry::DEBUG_LOG:
std::cout << QString("%1 %2 %3: %4").arg(timestamp).arg(entry.file()).arg(entry.line()).arg(entry.message()).toStdString() << std::endl;
break;
case LogEntry::ERROR_LOG:
std::cout << QString("%1 error: %2").arg(timestamp).arg(entry.message()).toStdString() << std::endl;
break;
case LogEntry::INFORMATION_LOG:
case LogEntry::MESSAGE_LOG:
case LogEntry::WORKFLOW_LOG:
std::cout << QString("%1: %2").arg(timestamp).arg(entry.message()).toStdString() << std::endl;
break;
case LogEntry::WARNING_LOG:
std::cout << QString("%1 warning: %2").arg(timestamp).arg(entry.message()).toStdString() << std::endl;
break;
case LogEntry::EMPTYLINE_LOG:
std::cout << std::endl << std::endl;
break;
case LogEntry::UNDEFINED_LOG:
default:
break;
}
}
示例2: format
/**
* \copydoc Formatter::format()
*/
string MPIAwareFormatter::format(const LogEntry& rEntry) const {
strftime(lStamp, sizeof(lStamp), TIME_FORMAT, &rEntry.time());
ostringstream entry;
entry << lRank;
#ifdef SUPPORT_OPENMP
entry << ":" << omp_get_thread_num();
#endif
entry << " " << setw(7) << rEntry.priority().toString() << setw(0)
<< " [" << lStamp << "] ";
if (lLocation) {
entry << rEntry.file() << "." << rEntry.function() << ":"
<< rEntry.line();
}
entry << " " << rEntry.message();
return entry.str();
}
示例3: print
void LogOutputWidget::print(const LogEntry &entry)
{
#ifdef _NDEBUG
const QString timestamp(entry.timestamp().toString("hh:mm:ss"));
#else
const QString timestamp(entry.timestamp().toString("hh:mm:ss:zzz"));
#endif
//const QString timestamp(entry.timestamp().toString("hh:mm:ss"));
m_swap->clear();
m_swap->setFont(font());
QString message = entry.message();
switch(entry.type())
{
case LogEntry::INFORMATION_LOG:
m_swap->textCursor().insertText(QString("%1: %2\n").arg(timestamp).arg(message), m_informationCharFormat);
break;
case LogEntry::WARNING_LOG:
m_swap->textCursor().insertText(QString("%1: %2\n").arg(timestamp).arg(message), m_warningCharFormat);
break;
case LogEntry::ERROR_LOG:
m_swap->textCursor().insertText(QString("%1: %2\n").arg(timestamp).arg(message), m_errorCharFormat);
break;
case LogEntry::DEBUG_LOG:
m_swap->textCursor().insertText(QString("%1 %2 %3: %4\n").arg(timestamp).arg(entry.file()).arg(entry.line()).arg(message), m_debugCharFormat);
break;
case LogEntry::MESSAGE_LOG:
m_swap->textCursor().insertText(QString("%1: %2\n").arg(timestamp).arg(message), m_messageCharFormat);
break;
case LogEntry::EMPTYLINE_LOG:
m_swap->textCursor().insertText("\n");
break;
case LogEntry::WORKFLOW_LOG:
case LogEntry::UNDEFINED_LOG:
default:
break;
};
QString htmlMessage = m_swap->toHtml();
QRegExp reEmail("\\b([A-Za-z0-9._%+-][email protected][A-Za-z0-9.-]+\\.[A-Za-z]{2,4})\\b");
QRegExp reLink("\\b((ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?)\\b");
int pos = 0;
while((pos = reEmail.indexIn(message, pos)) != -1)
{
pos += reEmail.matchedLength();
const QString email = reEmail.capturedTexts()[0];
htmlMessage.replace(email, QString("<a href =\"mailto:%1\">%1</a>").arg(email));
}
pos = 0;
while((pos = reLink.indexIn(message, pos)) != -1)
{
pos += reLink.matchedLength();
const QString link = reLink.capturedTexts()[0];
htmlMessage.replace(link, QString("<a href =\"%1\">%1</a>").arg(link));
}
m_cursor->insertHtml(htmlMessage);
ensureCursorVisible();
update();
}