Skip to content

Commit d901694

Browse files
authored
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.
1 parent dec0ed1 commit d901694

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sqlx-core/src/postgres/connection/stream.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,13 @@ impl PgStream {
146146
PgSeverity::Log => Level::Trace,
147147
};
148148

149-
if lvl <= log::STATIC_MAX_LEVEL && lvl <= log::max_level() {
149+
if log::log_enabled!(target: "sqlx::postgres::notice", lvl) {
150150
log::logger().log(
151151
&log::Record::builder()
152152
.args(format_args!("{}", notice.message()))
153153
.level(lvl)
154154
.module_path_static(Some("sqlx::postgres::notice"))
155+
.target("sqlx::postgres::notice")
155156
.file_static(Some(file!()))
156157
.line(Some(line!()))
157158
.build(),

0 commit comments

Comments
 (0)