本文整理汇总了C++中LogMessage::string方法的典型用法代码示例。如果您正苦于以下问题:C++ LogMessage::string方法的具体用法?C++ LogMessage::string怎么用?C++ LogMessage::string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogMessage
的用法示例。
在下文中一共展示了LogMessage::string方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: log
void Console::log(const LogMessage& message) {
if (message.string().empty())
return;
logToDebug(message);
logToFile(message);
if (m_textCtrl != NULL)
logToConsole(message);
else
m_buffer.push_back(message);
}
示例2: logToFile
void Console::logToFile(const LogMessage& message) {
#if defined __APPLE__
NSLogWrapper(message.string());
#else
IO::FileManager fileManager;
const String logDirectory = fileManager.logDirectory();
if (logDirectory.empty())
return;
if (!fileManager.exists(logDirectory))
fileManager.makeDirectory(logDirectory);
const String logFilePath = fileManager.appendPath(logDirectory, "TrenchBroom.log");
std::fstream logStream(logFilePath.c_str(), std::ios::out | std::ios::app);
if (logStream.is_open()) {
wxDateTime now = wxDateTime::Now();
logStream << wxGetProcessId() << " " << now.FormatISOCombined(' ') << ": " << message.string() << std::endl;
}
#endif
}
示例3: logToConsole
void Console::logToConsole(const LogMessage& message) {
long start = m_textCtrl->GetLastPosition();
m_textCtrl->AppendText(message.string());
m_textCtrl->AppendText("\n");
long end = m_textCtrl->GetLastPosition();
switch (message.level()) {
case LLDebug:
m_textCtrl->SetStyle(start, end, wxTextAttr(*wxLIGHT_GREY, *wxBLACK)); // SetDefaultStyle doesn't work on OS X / Cocoa
break;
case LLInfo:
m_textCtrl->SetStyle(start, end, wxTextAttr(*wxWHITE, *wxBLACK)); // SetDefaultStyle doesn't work on OS X / Cocoa
break;
case LLWarn:
m_textCtrl->SetStyle(start, end, wxTextAttr(*wxYELLOW, *wxBLACK)); // SetDefaultStyle doesn't work on OS X / Cocoa
break;
case LLError:
m_textCtrl->SetStyle(start, end, wxTextAttr(*wxRED, *wxBLACK)); // SetDefaultStyle doesn't work on OS X / Cocoa
break;
}
}