aboutsummaryrefslogtreecommitdiff
path: root/src/util/windows.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/windows.rs')
-rw-r--r--src/util/windows.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/util/windows.rs b/src/util/windows.rs
index 3b1339e..8856aed 100644
--- a/src/util/windows.rs
+++ b/src/util/windows.rs
@@ -1,3 +1,4 @@
+use grate::tracing;
use windows::{
core::{
HSTRING,
@@ -26,17 +27,17 @@ pub unsafe fn ensure_postgres_started() -> windows::core::Result<bool> {
match svc.status.dwCurrentState {
Services::SERVICE_RUNNING => {
- log::info!("postgres was already running, done");
+ tracing::info!("postgres was already running, done");
return Ok(false);
},
Services::SERVICE_START_PENDING => {
- log::info!("postgres was already in startup, done");
+ tracing::info!("postgres was already in startup, done");
return Ok(false);
},
_ => {
- log::info!("postgres is not running: starting it")
+ tracing::info!("postgres is not running: starting it")
},
}
@@ -45,7 +46,7 @@ pub unsafe fn ensure_postgres_started() -> windows::core::Result<bool> {
Services::StartServiceW(service, None)?;
- log::info!("started postgres service");
+ tracing::info!("started postgres service");
Services::CloseServiceHandle(service)?;
Services::CloseServiceHandle(sc_manager)?;
@@ -61,12 +62,12 @@ pub unsafe fn shutdown_postgres() -> windows::core::Result<()> {
)?;
let Some(svc) = get_psql_service(sc_manager)? else {
- log::warn!("wasn't able to find postgres service");
+ tracing::warn!("wasn't able to find postgres service");
return Ok(());
};
if svc.status.dwCurrentState != Services::SERVICE_RUNNING {
- log::warn!("postgres wasn't in running state, not attempting to shut it down");
+ tracing::warn!("postgres wasn't in running state, not attempting to shut it down");
return Ok(());
}
@@ -88,7 +89,7 @@ pub unsafe fn shutdown_postgres() -> windows::core::Result<()> {
&mut params as *mut _ as _,
)?;
- log::info!("stopped postgres service");
+ tracing::info!("stopped postgres service");
Services::CloseServiceHandle(service)?;
Services::CloseServiceHandle(sc_manager)?;
@@ -108,18 +109,18 @@ pub unsafe fn get_psql_service(
1 => {},
0 => {
- log::warn!("unable to identify an installed postgres service");
+ tracing::warn!("unable to identify an installed postgres service");
return Ok(None);
},
other => {
- log::warn!("unable to identify postgres service: {other} potential matches found");
+ tracing::warn!("unable to identify postgres service: {other} potential matches found");
return Ok(None);
},
}
let svc = psql_services.remove(0);
- log::debug!("identified postgres service: {}", svc.name);
+ tracing::debug!("identified postgres service: {}", svc.name);
Ok(Some(svc))
}