From e51028385bb9023dda03704a16a2309e30300316 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Thu, 5 Mar 2020 15:51:08 -0800 Subject: [PATCH] Log notices in Connection::poll impl --- tokio-postgres/src/connection.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tokio-postgres/src/connection.rs b/tokio-postgres/src/connection.rs index ac186743..9c8e369f 100644 --- a/tokio-postgres/src/connection.rs +++ b/tokio-postgres/src/connection.rs @@ -8,7 +8,7 @@ use fallible_iterator::FallibleIterator; use futures::channel::mpsc; use futures::stream::FusedStream; use futures::{ready, Sink, Stream, StreamExt}; -use log::trace; +use log::{info, trace}; use postgres_protocol::message::backend::Message; use postgres_protocol::message::frontend; use std::collections::{HashMap, VecDeque}; @@ -330,7 +330,11 @@ where type Output = Result<(), Error>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - while let Some(_) = ready!(self.poll_message(cx)?) {} + while let Some(message) = ready!(self.poll_message(cx)?) { + if let AsyncMessage::Notice(notice) = message { + info!("{}: {}", notice.severity(), notice.message()); + } + } Poll::Ready(Ok(())) } }