improve tracing logs

This commit is contained in:
OMGeeky
2024-05-02 17:25:57 +02:00
parent 946e07fde6
commit 206ef07292
4 changed files with 7 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "twba-splitter"
version = "0.1.2"
version = "0.1.3"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -26,7 +26,7 @@ impl SplitterClient {
}
impl SplitterClient {
#[tracing::instrument(skip(self))]
#[tracing::instrument(skip(self, video), fields(video_id = video.id))]
async fn split_video(&self, video: VideosModel) -> Result<()> {
//
let id = video.id.to_string();

View File

@@ -5,6 +5,7 @@ use anyhow::Context;
use chrono::Duration;
use std::path::{Path, PathBuf};
use tokio::process::Command;
use tracing::instrument;
/// Converts a duration to a string that is usable for example in an ffmpeg command
///
@@ -24,7 +25,7 @@ pub fn duration_to_string(duration: &Duration) -> String {
let seconds = seconds % 60;
format!("{:02}:{:02}:{:02}", hours, minutes, seconds)
}
#[instrument(skip(input_parts), fields(input_parts_amount = input_parts.parts.len(), total_duration = input_parts.total_duration.num_seconds()))]
pub(super) async fn join_last_parts_if_needed(
mut input_parts: PlaylistInfo,
base_folder: &Path,

View File

@@ -1,5 +1,6 @@
use super::*;
use tracing::instrument;
#[instrument(skip(join_txt_path, join_out_path))]
pub(crate) async fn run_ffmpeg_concat(
join_txt_path: impl Into<String>,
join_out_path: impl Into<String>,
@@ -29,7 +30,7 @@ pub(crate) async fn run_ffmpeg_concat(
debug!("Finished running ffmpeg command");
Ok(())
}
#[instrument(skip(input, target_duration, output_playlist, output_pattern))]
pub(crate) async fn run_ffmpeg_split(
input: &Path,
output_pattern: &String,