add query logging
This commit is contained in:
@@ -58,12 +58,18 @@ async fn get_tracks(
|
|||||||
.output()
|
.output()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
tracing::info!(
|
||||||
|
"yt-dlp output: {:?}",
|
||||||
|
String::from_utf8_lossy(&output.stdout)
|
||||||
|
);
|
||||||
|
|
||||||
let reader = BufReader::new(output.stdout.as_slice());
|
let reader = BufReader::new(output.stdout.as_slice());
|
||||||
let tracks: Vec<YouTubeTrack> = reader
|
let tracks: Vec<YouTubeTrack> = reader
|
||||||
.lines()
|
.lines()
|
||||||
.map_while(Result::ok)
|
.map_while(Result::ok)
|
||||||
.flat_map(|line| serde_json::from_str(&line))
|
.flat_map(|line| serde_json::from_str(&line))
|
||||||
.collect();
|
.collect();
|
||||||
|
tracing::info!("yt-dlp tracks: {:?}", tracks);
|
||||||
|
|
||||||
if tracks.is_empty() {
|
if tracks.is_empty() {
|
||||||
if let Ok(stderr) = String::from_utf8(output.stderr) {
|
if let Ok(stderr) = String::from_utf8(output.stderr) {
|
||||||
@@ -76,7 +82,7 @@ async fn get_tracks(
|
|||||||
}
|
}
|
||||||
return Err("No tracks found".into());
|
return Err("No tracks found".into());
|
||||||
}
|
}
|
||||||
tracing::debug!("tracks: {:?}", tracks);
|
tracing::info!("tracks: {:?}", tracks);
|
||||||
Ok(tracks)
|
Ok(tracks)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,6 +247,11 @@ pub(crate) async fn play(
|
|||||||
state: State,
|
state: State,
|
||||||
query: String,
|
query: String,
|
||||||
) -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
) -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
||||||
|
tracing::info!(
|
||||||
|
"play command in channel {:?} by {:?}",
|
||||||
|
interaction.channel,
|
||||||
|
interaction.author(),
|
||||||
|
);
|
||||||
match play_inner(&interaction, Arc::clone(&state), query).await {
|
match play_inner(&interaction, Arc::clone(&state), query).await {
|
||||||
Ok(_) => Ok(()),
|
Ok(_) => Ok(()),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
@@ -267,13 +278,14 @@ pub(crate) async fn play_inner(
|
|||||||
state: State,
|
state: State,
|
||||||
query: String,
|
query: String,
|
||||||
) -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
) -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
||||||
debug!(
|
tracing::info!(
|
||||||
"play command in channel {:?} by {:?}",
|
"play_inner in channel {:?} by {:?}",
|
||||||
interaction.channel,
|
interaction.channel,
|
||||||
interaction.author(),
|
interaction.author(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let content = format!("Adding track(s) to the queue: {}", query);
|
let content = format!("Adding track(s) to the queue: {}", query);
|
||||||
|
tracing::info!("content: {:?}", content);
|
||||||
let embeds = vec![EmbedBuilder::new()
|
let embeds = vec![EmbedBuilder::new()
|
||||||
.description(content)
|
.description(content)
|
||||||
.color(colors::YELLOW)
|
.color(colors::YELLOW)
|
||||||
@@ -308,9 +320,10 @@ pub(crate) async fn play_inner(
|
|||||||
query
|
query
|
||||||
};
|
};
|
||||||
|
|
||||||
debug!("query: {:?}", query);
|
tracing::info!("query: {:?}", query);
|
||||||
|
|
||||||
let tracks = get_tracks(query).await?;
|
let tracks = get_tracks(query).await?;
|
||||||
|
tracing::info!("got tracks: {:?}", tracks);
|
||||||
|
|
||||||
if tracks.len() > 1 {
|
if tracks.len() > 1 {
|
||||||
let first_track = tracks.first().unwrap();
|
let first_track = tracks.first().unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user