diff --git a/sqlx-core/src/logger.rs b/sqlx-core/src/logger.rs index 8c0298b4ac..ec16e59250 100644 --- a/sqlx-core/src/logger.rs +++ b/sqlx-core/src/logger.rs @@ -124,7 +124,10 @@ impl<'q> QueryLogger<'q> { db.statement = sql, rows_affected = self.rows_affected, rows_returned = self.rows_returned, + // Human-friendly - includes units (usually ms). Also kept for backward compatibility ?elapsed, + // Search friendly - numeric + elapsed_ms = i64::try_from(elapsed.as_millis()).ok(), // When logging to JSON, one can trigger alerts from the presence of this field. slow_threshold=?self.settings.slow_statements_duration, // Make sure to use "slow" in the message as that's likely @@ -139,7 +142,10 @@ impl<'q> QueryLogger<'q> { db.statement = sql, rows_affected = self.rows_affected, rows_returned = self.rows_returned, + // Human-friendly - includes units (usually ms). Also kept for backward compatibility ?elapsed, + // Search friendly - numeric + elapsed_ms = i64::try_from(elapsed.as_millis()).ok(), ); } }