mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
Add target context to Postgres notice logs (#1606)
Adds a `target` field to the Postgres notice logs and filters based on that target, just like how the query logs do it.
This commit is contained in:
parent
dec0ed1a4d
commit
d901694ec6
@ -146,12 +146,13 @@ impl PgStream {
|
||||
PgSeverity::Log => Level::Trace,
|
||||
};
|
||||
|
||||
if lvl <= log::STATIC_MAX_LEVEL && lvl <= log::max_level() {
|
||||
if log::log_enabled!(target: "sqlx::postgres::notice", lvl) {
|
||||
log::logger().log(
|
||||
&log::Record::builder()
|
||||
.args(format_args!("{}", notice.message()))
|
||||
.level(lvl)
|
||||
.module_path_static(Some("sqlx::postgres::notice"))
|
||||
.target("sqlx::postgres::notice")
|
||||
.file_static(Some(file!()))
|
||||
.line(Some(line!()))
|
||||
.build(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user