diff --git a/butane_core/src/lib.rs b/butane_core/src/lib.rs index ce58ce9a..7213c4e0 100644 --- a/butane_core/src/lib.rs +++ b/butane_core/src/lib.rs @@ -314,6 +314,8 @@ impl std::fmt::Display for SqlType { #[cfg(feature = "log")] pub use log::debug; #[cfg(feature = "log")] +pub use log::info; +#[cfg(feature = "log")] pub use log::warn; #[cfg(not(feature = "log"))] @@ -327,6 +329,13 @@ mod btlog { ($($arg:tt)+) => {}; } + /// Noop for when feature log is not enabled. + #[macro_export] + macro_rules! info { + (target: $target:expr, $($arg:tt)+) => {}; + ($($arg:tt)+) => {}; + } + /// Noop for when feature log is not enabled. #[macro_export] macro_rules! warn { diff --git a/butane_core/src/migrations/fsmigrations.rs b/butane_core/src/migrations/fsmigrations.rs index dbb2dd23..f0df00ce 100644 --- a/butane_core/src/migrations/fsmigrations.rs +++ b/butane_core/src/migrations/fsmigrations.rs @@ -371,6 +371,7 @@ impl MigrationsMut for FsMigrations { &mut self.current } fn clear_current(&mut self) -> Result<()> { + crate::info!("Deleting {}", self.current.root.display()); std::fs::remove_dir_all(&self.current.root)?; Ok(()) } @@ -394,6 +395,10 @@ impl MigrationsMut for FsMigrations { } fn clear_migrations(&mut self, conn: &impl ConnectionMethods) -> Result<()> { + crate::info!( + "Deleting everything in {} except 'current'", + self.root.display() + ); for entry in std::fs::read_dir(&self.root)? { let entry = entry?; if matches!(entry.path().file_name(), Some(name) if name == "current") { diff --git a/butane_test_helper/src/lib.rs b/butane_test_helper/src/lib.rs index f4ec88a9..315f30e7 100644 --- a/butane_test_helper/src/lib.rs +++ b/butane_test_helper/src/lib.rs @@ -47,6 +47,10 @@ impl Drop for PgServerState { self.proc.kill().ok(); let mut buf = String::new(); self.stderr.read_to_string(&mut buf).unwrap(); + if !buf.is_empty() { + log::warn!("pg shutdown error: {buf}"); + } + log::info!("Deleting {}", self.dir.display()); std::fs::remove_dir_all(&self.dir).unwrap(); } }