diff options
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/mod.rs | 8 | ||||
| -rw-r--r-- | src/util/windows.rs | 21 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/util/mod.rs b/src/util/mod.rs index b9e5f0f..c5bed98 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -1,8 +1,8 @@ use std::process::Stdio; use chrono::Duration; +use grate::tracing; use lazy_static::lazy_static; -use log::debug; use poise::{ CreateReply, FrameworkError, @@ -161,7 +161,7 @@ pub async fn send_result( tts: bool, ) -> anyhow::Result<MessageId> { let text = text.as_ref(); - debug!("sending message {:?} to channel {:?} (tts: {})", text, channel, tts); + tracing::debug!("sending message {:?} to channel {:?} (tts: {})", text, channel, tts); let result = channel.send_message(ctx, CreateMessage::default().content(text).tts(tts)).await?; Ok(result.id) @@ -203,12 +203,12 @@ pub async fn ytdl_url(uri: &str) -> anyhow::Result<String> { uri, ]; - debug!("downloading info for uri: {uri}"); + tracing::debug!("downloading info for uri: {uri}"); let mut command = Command::new(&*crate::config::YTDL_COMMAND); command.args(args).stdin(Stdio::null()); - debug!("running command: {command:?}"); + tracing::debug!("running command: {command:?}"); let out = command.output().await?; 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)) } |
