async-bech to use spdlog for output
This commit is contained in:
parent
b1277caeeb
commit
40143cae1e
@ -50,11 +50,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
try
|
||||
{
|
||||
auto console = spdlog::stdout_color_mt("console");
|
||||
if (argc == 1)
|
||||
{
|
||||
console->set_pattern("%v");
|
||||
console->info("Usage: {} <message_count> <threads> <q_size> <iterations>", argv[0]);
|
||||
spdlog::set_pattern("%v");
|
||||
spdlog::info("Usage: {} <message_count> <threads> <q_size> <iterations>", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -68,12 +67,12 @@ int main(int argc, char *argv[])
|
||||
if (argc > 4)
|
||||
iters = atoi(argv[4]);
|
||||
|
||||
console->info("-------------------------------------------------");
|
||||
console->info("Messages: {:14n}", howmany);
|
||||
console->info("Threads : {:14n}", threads);
|
||||
console->info("Queue : {:14n}", queue_size);
|
||||
console->info("Iters : {:>14n}", iters);
|
||||
console->info("-------------------------------------------------");
|
||||
spdlog::info("-------------------------------------------------");
|
||||
spdlog::info("Messages: {:14n}", howmany);
|
||||
spdlog::info("Threads : {:14n}", threads);
|
||||
spdlog::info("Queue : {:14n}", queue_size);
|
||||
spdlog::info("Iters : {:>14n}", iters);
|
||||
spdlog::info("-------------------------------------------------");
|
||||
|
||||
const char *filename = "logs/basic_async.log";
|
||||
|
||||
@ -87,12 +86,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (count != howmany)
|
||||
{
|
||||
console->error("Test failed. {} has {:n} lines instead of {:n}", filename, count, howmany);
|
||||
spdlog::error("Test failed. {} has {:n} lines instead of {:n}", filename, count, howmany);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
console->info("Line count OK ({:n})\n", count);
|
||||
spdlog::info("Line count OK ({:n})\n", count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -136,5 +135,5 @@ void bench_mt(int howmany, std::shared_ptr<spdlog::logger> logger, int thread_co
|
||||
|
||||
auto delta = high_resolution_clock::now() - start;
|
||||
auto delta_d = duration_cast<duration<double>>(delta).count();
|
||||
spdlog::get("console")->info("Elapsed: {} secs\t {:n}/sec", delta_d, int(howmany / delta_d));
|
||||
spdlog::info("Elapsed: {} secs\t {:n}/sec", delta_d, int(howmany / delta_d));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user