Add a DEBUG_SQL_QUERIES to log info about the executed SQL queries

fix #3324
This commit is contained in:
louiz’
2018-01-14 21:46:49 +01:00
parent 3cd6490236
commit 7e64a2e361
11 changed files with 82 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
#include <utils/scopeguard.hpp>
#include <chrono>
#include <logger/logger.hpp>
template <typename Callback>
auto make_scope_timer(Callback cb)
{
const auto start_time = std::chrono::steady_clock::now();
return utils::make_scope_guard([start_time, cb = std::move(cb)]()
{
const auto now = std::chrono::steady_clock::now();
const auto elapsed = now - start_time;
cb(elapsed);
});
}