本文整理汇总了C++中LogFile::write方法的典型用法代码示例。如果您正苦于以下问题:C++ LogFile::write方法的具体用法?C++ LogFile::write怎么用?C++ LogFile::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogFile
的用法示例。
在下文中一共展示了LogFile::write方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
try
{
LogFile dummy;
dummy.write("Writing from main");
}
catch (const LogFileException& ex)
{
cerr << ex.what();
}
try
{
LogFile logFile("Exceptions.log");
logFile.write("Writing from main");
logFile.write("Writing from main - again");
}
catch (const LogFileException& ex)
{
cerr << ex.what();
}
getchar();
}
示例2:
virtual void handleRec(const LogRecordPtr& rec)
{
if (logfile.isOpen() && !ignore(rec))
{
std::string msg;
formatLog(rec, msg);
hasWriten+= logfile.write(msg.c_str(), msg.length());
if (hasWriten >= flushEvery) {
logfile.flush();
hasWriten -= flushEvery;
}
}
}
示例3: ParseHttpHEAD
//.........这里部分代码省略.........
if( strToken != "2")
{
ContinueToCycle = mLexer.GetNextToken(&currToken, true);
strToken += string(currToken.ps, currToken.mLen);
ContinueToCycle = mLexer.GetNextToken(&currToken, true);
strToken += string(currToken.ps, currToken.mLen);
if( strToken == "1.1")
{
isProtocolVersion_1_1 = true;
}
}
}
else
{
continue; // we have to go to the next iteration of the loop without using function GetNextToken
}
}
// This is WebSocket? If not we stop parcing
if( strToken == "Upgrade" )
{
ContinueToCycle = mLexer.GetNextToken(&currToken, true);
if( string(currToken.ps, currToken.mLen) == ":" )
{
ContinueToCycle = mLexer.GetNextToken(&currToken, true);
strToken = string(currToken.ps, currToken.mLen);
if( strToken == "websocket" || strToken == "WebSocket" )
isWebSocket = true;
else
break;
}
else
{
continue; // we have to go to the next iteration of the loop without using function GetNextToken
}
}
// Find WebSocket Key
if( strToken == "Sec-WebSocket-Key" )
{
ContinueToCycle = mLexer.GetNextToken(&currToken, true);
if( string(currToken.ps, currToken.mLen) == ":" )
{
string PartOfKey;
do
{
WebSocketKey += PartOfKey;
ContinueToCycle = mLexer.GetNextToken(&currToken, true);
PartOfKey = string(currToken.ps, currToken.mLen);
}
while(PartOfKey != "\n" && PartOfKey != "\r");
}
else
{
continue; // we have to go to the next iteration of the loop without using function GetNextToken
}
}
// Check version of WebSocket? we work only with version 13
if( strToken == "Sec-WebSocket-Version" )
{
ContinueToCycle = mLexer.GetNextToken(&currToken, true);
if( string(currToken.ps, currToken.mLen) == ":" )
{
ContinueToCycle = mLexer.GetNextToken(&currToken, true);
if(string(currToken.ps, currToken.mLen) == "13")
isWebSocketVersion_13 = true;
}
else
{
continue; // we have to go to the next iteration of the loop without using function GetNextToken
}
}
prevToken = currToken;
ContinueToCycle = mLexer.GetNextToken(&currToken, true);
}
GenerateResponse(
inSSL,
isGET,
isProtocolVersion_1_1,
isWebSocket,
isWebSocketVersion_13,
FileName,
FileType,
WebSocketKey);
}
catch(exception& e)
{
LogFile log;
log.write(e.what());
}
return 0;
}