2014-01-25 21:52:10 +08:00
|
|
|
// test.cpp : Defines the entry point for the console application.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
|
|
|
2014-01-25 23:28:56 +08:00
|
|
|
|
2014-01-25 21:52:10 +08:00
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
|
|
|
|
c11log::logger logger("test");
|
|
|
|
|
2014-01-25 23:28:56 +08:00
|
|
|
auto screen_sink = std::make_shared<c11log::sinks::stdout_sink>();
|
|
|
|
auto file_sink = std::make_shared<c11log::sinks::midnight_file_sink>("logtest");
|
|
|
|
auto async = std::make_shared<c11log::sinks::async_sink>(1000);
|
|
|
|
async->add_sink(file_sink);
|
2014-01-25 21:52:10 +08:00
|
|
|
logger.add_sink(async);
|
2014-01-25 23:28:56 +08:00
|
|
|
//logger.add_sink(file_sink);
|
|
|
|
|
|
|
|
|
|
|
|
auto fn = [&logger]()
|
|
|
|
{
|
|
|
|
logger.info() << "Hello logger!";
|
|
|
|
};
|
|
|
|
utils::bench("test log", std::chrono::seconds(3), fn);
|
|
|
|
logger.info() << "bye";
|
|
|
|
utils::bench("shutdown", [&async]() {
|
|
|
|
async->shutdown(std::chrono::seconds(10));
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2014-01-25 21:52:10 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|