From b4a2cebb9771c16dc0b79dafccb87e022fd0842e Mon Sep 17 00:00:00 2001 From: Lev Saminskij <103888491+Kirari04@users.noreply.github.com> Date: Wed, 1 Mar 2023 14:57:21 +0000 Subject: [PATCH] added method to disable the logging of the compiled ffmpeg command --- run.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/run.go b/run.go index e917404..c852dda 100644 --- a/run.go +++ b/run.go @@ -253,7 +253,12 @@ func (s *Stream) SetFfmpegPath(path string) *Stream { return s } -// for test +var LogCompiledCommand bool = true + +func (s *Stream) Silent(isSilent bool) *Stream { + LogCompiledCommand = !isSilent + return s +} func (s *Stream) Compile(options ...CompilationOption) *exec.Cmd { args := s.GetArgs() cmd := exec.CommandContext(s.Context, s.FfmpegPath, args...) @@ -269,7 +274,9 @@ func (s *Stream) Compile(options ...CompilationOption) *exec.Cmd { for _, option := range options { option(s, cmd) } - log.Printf("compiled command: ffmpeg %s\n", strings.Join(args, " ")) + if LogCompiledCommand { + log.Printf("compiled command: ffmpeg %s\n", strings.Join(args, " ")) + } return cmd }