From aa5c7fc159b0f5175ede96d46b8d2a2669a176a4 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 28 Dec 2022 13:27:05 +0100 Subject: llog: use variable argument list Mirror more closely the fmt interface and reduce the verbosity of the log call sites. Additionally the log message is only created if we are actually going to log it. --- youtube.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'youtube.go') diff --git a/youtube.go b/youtube.go index 8997bc9..547e555 100644 --- a/youtube.go +++ b/youtube.go @@ -27,11 +27,11 @@ type YoutubeDlSearchResult struct { func (b *YoutubeBackend) Search(pattern string) []Song { searchOption := fmt.Sprintf("ytsearch%d:%s", b.searchResults, pattern) - llog.Debug(fmt.Sprintf("Search youtube using: youtube-dl -j %s", searchOption)) + llog.Debug("Search youtube using: youtube-dl -j %s", searchOption) results, err := exec.Command("youtube-dl", "-j", searchOption).Output() if err != nil { - llog.Error(fmt.Sprintf("youtube-dl failed with: %s", err)) + llog.Error("youtube-dl failed with: %s", err) } songs := []Song{} @@ -43,12 +43,12 @@ func (b *YoutubeBackend) Search(pattern string) []Song { result := YoutubeDlSearchResult{} err = json.Unmarshal([]byte(l), &result) if err != nil { - llog.Debug(fmt.Sprintf("Parsing youtube-dl results '%s' failed", l)) - llog.Error(fmt.Sprintf("Parsing youtube-dl results failed with: %s", err)) + llog.Debug("Parsing youtube-dl results '%s' failed", l) + llog.Error("Parsing youtube-dl results failed with: %s", err) } songs = append(songs, NewSong(result.Title, "", "youtube", result.Id)) } - llog.Debug(fmt.Sprintf("youtube found %d matching videos", len(songs))) + llog.Debug("youtube found %d matching videos", len(songs)) return songs } -- cgit v1.2.3