Switch to tracing
This commit is contained in:
Generated
+1
-1
@@ -9540,11 +9540,11 @@ dependencies = [
|
||||
name = "sqlx-pool-guard"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"proc_pidinfo",
|
||||
"sqlx",
|
||||
"tempfile",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"windows 0.61.1",
|
||||
]
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ tokio = { workspace = true, features = [
|
||||
"fs",
|
||||
] }
|
||||
sqlx = { workspace = true, features = ["runtime-tokio-rustls", "sqlite"] }
|
||||
log.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
proc_pidinfo.workspace = true
|
||||
|
||||
@@ -20,7 +20,7 @@ pub async fn check_files_closed(file_paths: &[&Path]) -> io::Result<bool> {
|
||||
{
|
||||
let Some(vnode) = proc_pidfdinfo_self::<VnodeFdInfoWithPath>(fd.proc_fd)
|
||||
.inspect_err(|e| {
|
||||
log::warn!("proc_pidfdinfo_self::<VnodeFdInfoWithPath>() failure: {e}");
|
||||
tracing::warn!("proc_pidfdinfo_self::<VnodeFdInfoWithPath>() failure: {e}");
|
||||
})
|
||||
.ok()
|
||||
.flatten()
|
||||
@@ -32,7 +32,7 @@ pub async fn check_files_closed(file_paths: &[&Path]) -> io::Result<bool> {
|
||||
.path()
|
||||
.map(|vnode_path| file_paths.contains(&vnode_path))
|
||||
.inspect_err(|e| {
|
||||
log::warn!("vnode.path() failure: {e:?}");
|
||||
tracing::warn!("vnode.path() failure: {e:?}");
|
||||
})
|
||||
{
|
||||
return Ok(false);
|
||||
|
||||
@@ -55,7 +55,7 @@ impl SqlitePoolGuard {
|
||||
pub async fn close(&self) {
|
||||
// Avoid waiting for db files once the pool is marked closed to ensure that we don't wait on some other sqlite pool to close the database.
|
||||
if !self.connection_pool.is_closed() {
|
||||
log::info!("Closing sqlite pool: {}", self.database_path.display());
|
||||
tracing::info!("Closing sqlite pool: {}", self.database_path.display());
|
||||
_ = self.close_pool_inner();
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ impl SqlitePoolGuard {
|
||||
self.connection_pool.close().await;
|
||||
|
||||
if let Err(e) = self.wait_for_db_files_close().await {
|
||||
log::error!("Failed to wait for file to close: {e}");
|
||||
tracing::error!("Failed to wait for file to close: {e}");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -77,7 +77,7 @@ impl SqlitePoolGuard {
|
||||
.database_path
|
||||
.canonicalize()
|
||||
.inspect_err(|e| {
|
||||
log::error!(
|
||||
tracing::error!(
|
||||
"Failed to canonicalize path: {}. Cause: {e}",
|
||||
self.database_path.display()
|
||||
);
|
||||
@@ -103,7 +103,7 @@ impl SqlitePoolGuard {
|
||||
for _ in 0..CHECK_FILES_CLOSED_MAX_ATTEMPTS {
|
||||
match imp::check_files_closed(&paths)
|
||||
.await
|
||||
.inspect_err(|e| log::error!("imp::check_files_closed() failure: {e}"))
|
||||
.inspect_err(|e| tracing::error!("imp::check_files_closed() failure: {e}"))
|
||||
{
|
||||
Ok(false) | Err(_) => tokio::time::sleep(CHECK_FILES_CLOSED_RETRY_DELAY).await,
|
||||
Ok(true) => return Ok(()),
|
||||
|
||||
@@ -16,7 +16,7 @@ pub async fn check_files_closed(file_paths: &[&Path]) -> io::Result<bool> {
|
||||
if entry
|
||||
.file_type()
|
||||
.await
|
||||
.inspect_err(|e| log::warn!("entry.file_type() failure: {e}"))
|
||||
.inspect_err(|e| tracing::warn!("entry.file_type() failure: {e}"))
|
||||
.is_ok_and(|entry_type| entry_type.is_symlink())
|
||||
{
|
||||
match tokio::fs::read_link(entry.path()).await {
|
||||
@@ -26,7 +26,7 @@ pub async fn check_files_closed(file_paths: &[&Path]) -> io::Result<bool> {
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("Failed to read symlink: {e}");
|
||||
tracing::error!("Failed to read symlink: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ pub async fn check_files_closed(file_paths: &[&Path]) -> io::Result<bool> {
|
||||
|
||||
// Buffer is too small, resize memory and retry again.
|
||||
if status == STATUS_INFO_LENGTH_MISMATCH {
|
||||
log::trace!("Buffer is too small ({reserved_memory}), resizing to {return_len}");
|
||||
tracing::trace!("Buffer is too small ({reserved_memory}), resizing to {return_len}");
|
||||
reserved_memory = return_len as usize;
|
||||
handle_table_info.reallocate(reserved_memory)?;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user