bench update

This commit is contained in:
gabi 2014-10-18 19:04:24 +03:00
parent b36a803469
commit f4d9c31a2f
2 changed files with 14 additions and 23 deletions

View File

@ -8,14 +8,12 @@
#include "c11log/sinks/null_sink.h"
#include "utils.h"
using std::cout;
using std::endl;
using namespace std::chrono;
using namespace c11log;
using namespace utils;
int main_(int argc, char* argv[])
int main(int argc, char* argv[])
{
const unsigned int howmany = argc <= 1 ? 500000 : atoi(argv[1]);
@ -26,9 +24,9 @@ int main_(int argc, char* argv[])
cout_logger.info() << "Hello logger " << 1234;
auto nullsink = std::make_shared<sinks::null_sink_st>();
//auto rotating = std::make_shared<sinks::rotating_file_sink_mt>("myrotating", "txt", 1024 * 1024 * 5, 5, 100);
auto rotating = std::make_shared<sinks::rotating_file_sink_mt>("myrotating", "txt", 1024 * 1024 * 5, 5, 1);
logger my_logger("my_logger", { nullsink });
logger my_logger("my_logger", { rotating });
auto start = system_clock::now();
for (unsigned int i = 1; i <= howmany; ++i)

View File

@ -8,28 +8,21 @@
#include "c11log/sinks/stdout_sinks.h"
#include "c11log/sinks/file_sinks.h"
using namespace std;
using namespace c11log;
int main(int, char* [])
details::fast_oss f(const std::string& what)
{
details::fast_oss oss;
oss << what;
return oss;
}
int main_(int, char* [])
{
auto console = c11log::factory::stdout_logger();
auto file = c11log::factory::simple_file_logger("log.txt");
auto rotating= c11log::factory::rotating_file_logger("myrotating", "txt", 1024*1024*5, 5, 1);
auto daily = c11log::factory::daily_file_logger("dailylog", "txt", 1, "daily_logger");
auto foss = f("test2");
foss.str();
//console->info() << "This is variadic ", " func, ", 123 << " YES";
FFLOG_TRACE(console, "This is ", 1);
file->info("Hello file log");
rotating->info("Hello rotating log");
daily->info("Hello daily log");
//multi sink logger: file + console
auto sink1= std::make_shared<c11log::sinks::stdout_sink_mt>();
auto sink2 = std::make_shared<c11log::sinks::daily_file_sink_mt>("rotating", "txt");
c11log::logger combined("combined", { sink1, sink2 });
return 0;
}