コード例 #1
0
ファイル: lib_cpp.cpp プロジェクト: noname22/Flog
int main(int argc, char** argv)
{
	Flog_Init("Testapp");

	Flog_AddTargetStream(stdout, Flog_SDebug1 |Flog_SDebug2 | Flog_SDebug3 | Flog_SVerbose | Flog_SInfo | Flog_SWarning, 1);
	Flog_AddTargetStream(stderr, Flog_SError | Flog_SFatal, 1);
	
	if( !Flog_AddTargetServer("localhost", Flog_DefaultPort, Flog_SAll) ){
		printf("couldn't connect to server\n");
		return 1;
	}

	std::string testString = "value";

	FlogExpD1(testString);

	FlogD1("debug level " << 1);
	FlogD2("debug level " << 2);
	FlogD3("debug level " << 3);
	FlogD("debug default level");
	FlogV("verbose");
	FlogI("info");
	FlogW("warning");
	FlogE("error");
	FlogF("fatal error");
	
	FlogAssert(argc == 1, "Not one arugment, exiting");
	FlogDie("DEATH");

	return 0;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: guyt101z/FastWebServer
int main()
{
	Flog_Init(SPANK_NAME);

	Flog_AddTargetStream(stdout, Flog_SDebug1 |Flog_SDebug2 | Flog_SDebug3 | Flog_SVerbose | Flog_SInfo | Flog_SWarning, 1);
	Flog_AddTargetStream(stderr, Flog_SError | Flog_SFatal, 1);

	FlogI("Welcome to " << SPANK_NAME << " " << SPANK_VERSION);

	Server server;

	// Memory cached static data
	server.AddRequestHandler("/", new Cached(new StaticResource("data/index.html")));
	server.AddRequestHandler("/favicon.ico", new Cached(new StaticResource("data/favicon.ico")));

	// Non-cached static data	
	server.AddRequestHandler("/heart.png", new StaticResource("data/heart.png"));

	// Non-cached dynamic page
	server.AddRequestHandler("/dynamic", new DynamicTest());

	// Cached dynamic page
	server.AddRequestHandler("/time", new Cached(new ServerTime()));
	
	FlogAssert( signal(SIGHUP, HandleSigHup) != SIG_ERR, "Could not set signal handler");

	server.ListenForever();

	return 0;
}