example.cpp fix

This commit is contained in:
gabime 2018-04-28 19:29:10 +03:00
parent f2023e80a8
commit d51102a168
2 changed files with 6 additions and 6 deletions

View File

@ -33,7 +33,7 @@ int main(int argc, char *argv[])
int queue_size = 1048576;
int howmany = 1000000;
int threads = 10;
int threads = 1;
int file_size = 30 * 1024 * 1024;
int rotating_files = 5;
@ -46,7 +46,7 @@ int main(int argc, char *argv[])
threads = atoi(argv[2]);
if (argc > 3)
queue_size = atoi(argv[3]);
/*
cout << "*******************************************************************************\n";
cout << "Single thread, " << format(howmany) << " iterations" << endl;
cout << "*******************************************************************************\n";
@ -67,15 +67,15 @@ int main(int argc, char *argv[])
auto daily_mt = spdlog::daily_logger_mt("daily_mt", "logs/daily_mt.log");
bench_mt(howmany, daily_mt, threads);
bench(howmany, spdlog::create<null_sink_st>("null_mt"));
*/
cout << "\n*******************************************************************************\n";
cout << "async logging.. " << threads << " threads sharing same logger, " << format(howmany) << " iterations " << endl;
cout << "*******************************************************************************\n";
for (int i = 0; i < 3; ++i)
for (int i = 0; i < 300; ++i)
{
spdlog::init_thread_pool(queue_size, 1);
auto as = spdlog::daily_logger_mt<spdlog::create_async>("as", "logs/daily_async.log");
auto as = spdlog::basic_logger_mt<spdlog::create_async>("as", "logs/basic_async.log", true);
bench_mt(howmany, as, threads);
spdlog::drop("as");
}

View File

@ -59,7 +59,7 @@ int main(int, char *[])
daily_logger->info(123.44);
// Customize msg format for all messages
// spd::set_pattern("[%^+++%$] [%H:%M:%S %z] [thread %t] %v"); //crash
spd::set_pattern("[%^+++%$] [%H:%M:%S %z] [thread %t] %v");
console->info("This an info message with custom format");
console->error("This an error message with custom format");