mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 15:25:32 +00:00
chore: Use tracing's fields to get structured logs
This also enables on services that can query this data to get useful metrics
This commit is contained in:
parent
21c2660062
commit
82ff8d96b3
@ -114,12 +114,15 @@ impl<'q> QueryLogger<'q> {
|
||||
String::new()
|
||||
};
|
||||
|
||||
let message = format!(
|
||||
"{}; rows affected: {}, rows returned: {}, elapsed: {:.3?}{}",
|
||||
summary, self.rows_affected, self.rows_returned, elapsed, sql
|
||||
private_tracing_dynamic_event!(
|
||||
target: "sqlx::query",
|
||||
tracing_level,
|
||||
summary,
|
||||
db.statement = sql,
|
||||
rows_affected = self.rows_affected,
|
||||
rows_returned= self.rows_returned,
|
||||
?elapsed,
|
||||
);
|
||||
|
||||
private_tracing_dynamic_event!(target: "sqlx::query", tracing_level, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user