当前位置: 首页>>代码示例>>C++>>正文


C++ LogFile::write方法代码示例

本文整理汇总了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();
}
开发者ID:Todtaure,项目名称:ITAPK_Exercises,代码行数:25,代码来源:ProgramTransformation.cpp

示例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;
				}
			}
		}
开发者ID:John-Chan,项目名称:logcpp-prebuild,代码行数:13,代码来源:def_appender.hpp

示例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;
}
开发者ID:Cempl,项目名称:http-server-ws,代码行数:101,代码来源:Response.cpp


注:本文中的LogFile::write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。