aboutsummaryrefslogtreecommitdiff
path: root/src/commands/meme
diff options
context:
space:
mode:
authorNathan Perry <np@nathanperry.dev>2024-08-16 07:12:33 -0400
committerNathan Perry <np@nathanperry.dev>2024-08-16 07:12:33 -0400
commitc5ce454319a7d54d3967c6ea7695543e943a37b2 (patch)
tree193a6907bc3a476f18774558ca52a3cb7618f912 /src/commands/meme
parent5a2dc4070c1d14f22a7671c6f82ca2f4578369bd (diff)
tracing: use fields rather than interpolation
Diffstat (limited to 'src/commands/meme')
-rw-r--r--src/commands/meme/create.rs4
-rw-r--r--src/commands/meme/delete.rs2
-rw-r--r--src/commands/meme/history.rs9
-rw-r--r--src/commands/meme/mod.rs2
4 files changed, 9 insertions, 8 deletions
diff --git a/src/commands/meme/create.rs b/src/commands/meme/create.rs
index a4e9656..c6ed9c6 100644
--- a/src/commands/meme/create.rs
+++ b/src/commands/meme/create.rs
@@ -109,7 +109,7 @@ pub async fn addaudiomeme(
util::react(ctx, '🔃').await?;
let youtube_url = util::ytdl_url(audio_link.as_str()).await?;
- tracing::debug!("got download url: {youtube_url}");
+ tracing::debug!(url_string = &youtube_url, "got download url");
let duration_opts = if let Some(e) = end {
vec![
@@ -162,7 +162,7 @@ pub async fn addaudiomeme(
let mut audio_data = Vec::new();
let bytes = audio_reader.read_to_end(&mut audio_data).await?;
- tracing::debug!("downloaded audio ({} bytes)", audio_data.len());
+ tracing::debug!(len_bytes = audio_data.len(), "downloaded audio");
if bytes == 0 {
tracing::debug!("read 0 bytes from audio reader");
diff --git a/src/commands/meme/delete.rs b/src/commands/meme/delete.rs
index 560da28..8adaa6c 100644
--- a/src/commands/meme/delete.rs
+++ b/src/commands/meme/delete.rs
@@ -26,7 +26,7 @@ pub async fn delmeme(ctx: PoiseContext<'_>, title: String) -> anyhow::Result<()>
},
Err(e) => {
if let Some(NotFound) = e.downcast_ref::<DieselError>() {
- tracing::info!("attempted to delete nonexistent meme: '{}'", title);
+ tracing::info!(title, "attempted to delete nonexistent meme");
util::react(ctx, ReactionType::Unicode("❓".to_owned())).await?;
util::reply(ctx, "nice try").await?;
diff --git a/src/commands/meme/history.rs b/src/commands/meme/history.rs
index e3d0de3..d6ccdcf 100644
--- a/src/commands/meme/history.rs
+++ b/src/commands/meme/history.rs
@@ -107,9 +107,10 @@ pub async fn history(ctx: PoiseContext<'_>, n: Option<usize>) -> anyhow::Result<
if n > CONFIG.max_hist {
tracing::debug!(
- "user requested more than MAX_HIST ({}) items from history",
- CONFIG.max_hist
+ MAX_HIST = CONFIG.max_hist,
+ "user requested more than MAX_HIST items from history",
);
+
util::reply(ctx, "YER PUSHIN ME OVER THE FUCKIN LINE").await?;
}
@@ -127,7 +128,7 @@ pub async fn history(ctx: PoiseContext<'_>, n: Option<usize>) -> anyhow::Result<
return Ok(());
}
- tracing::info!("reporting meme history (len {})", n);
+ tracing::info!(len = n, "reporting meme history");
let resp = serenity::futures::stream::iter(records.into_iter().enumerate().rev())
.then(|(i, rec)| async move {
@@ -181,7 +182,7 @@ pub async fn history(ctx: PoiseContext<'_>, n: Option<usize>) -> anyhow::Result<
Err(e) => {
if let Some(variant) = e.downcast_ref::<DieselError>() {
if *variant != NotFound {
- tracing::error!("error encountered loading meme history: {}", e);
+ tracing::error!(error = %e, "error encountered loading meme history");
}
}
diff --git a/src/commands/meme/mod.rs b/src/commands/meme/mod.rs
index 4819c1d..7bc8b2e 100644
--- a/src/commands/meme/mod.rs
+++ b/src/commands/meme/mod.rs
@@ -70,7 +70,7 @@ async fn send_meme(
let should_tts =
t.content.as_ref().map(|t| !t.is_empty()).unwrap_or(false) && random::<u32>() % 25 == 0;
- tracing::debug!("sending meme (tts: {}): {:?}", should_tts, t);
+ tracing::debug!(should_tts, meme = ?t, "sending meme");
let image = t.image(conn).await;
let audio = t.audio(conn).await;