spdlog/test/test.cpp

36 lines
775 B
C++
Raw Normal View History

2014-01-25 08:52:10 -05:00
// test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
2014-01-25 10:28:56 -05:00
2014-01-25 08:52:10 -05:00
int main(int argc, char* argv[])
{
c11log::logger logger("test");
2014-01-25 10:28:56 -05: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 08:52:10 -05:00
logger.add_sink(async);
2014-01-25 10:28:56 -05: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 08:52:10 -05:00
return 0;
}