Skip to content

Commit d0a9b3d

Browse files
committed
add query execution time to info log
fixes #118
1 parent f9cc124 commit d0a9b3d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/CQuery.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ bool CQuery::Execute(MYSQL *connection)
2424
error_str ? error_str : "(nullptr)");
2525
return false;
2626
}
27-
CLog::Get()->Log(LogLevel::INFO, "query \"{}\" successfully executed", m_Query);
27+
28+
auto
29+
query_exec_time_milli = std::chrono::duration_cast<std::chrono::milliseconds>(exec_time).count(),
30+
query_exec_time_micro = std::chrono::duration_cast<std::chrono::microseconds>(exec_time).count();
31+
32+
CLog::Get()->Log(LogLevel::INFO,
33+
"query \"{}\" successfully executed within {}.{} milliseconds",
34+
m_Query, query_exec_time_milli,
35+
query_exec_time_micro - (query_exec_time_milli * 1000));
2836

2937
m_Result = CResultSet::Create(connection, exec_time, m_Query);
3038
return m_Result != nullptr;

0 commit comments

Comments
 (0)