diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2022-12-28 13:27:05 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2022-12-28 13:27:05 +0100 |
| commit | aa5c7fc159b0f5175ede96d46b8d2a2669a176a4 (patch) | |
| tree | 58964be878af574263b8d1994f3097860db2192e /player.go | |
| parent | e15e1c6a4cb4a534d649cfc3d1be68498fddac48 (diff) | |
| download | WRMS-aa5c7fc159b0f5175ede96d46b8d2a2669a176a4.tar.gz WRMS-aa5c7fc159b0f5175ede96d46b8d2a2669a176a4.zip | |
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.
Diffstat (limited to 'player.go')
| -rw-r--r-- | player.go | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -1,7 +1,6 @@ package main import ( - "fmt" "io" "os/exec" "syscall" @@ -31,11 +30,11 @@ func NewPlayer(wrms *Wrms, backends []string) Player { case "local": b = NewLocalBackend(wrms.Config.localMusicDir) default: - llog.Error(fmt.Sprintf("Not supported backend %s", backend)) + llog.Error("Not supported backend %s", backend) } if err != nil { - llog.Error(fmt.Sprintf("Error during initialization of the %s backend: %s", backend, err.Error())) + llog.Error("Error during initialization of the %s backend: %s", backend, err.Error()) } else { available_backends[backend] = b } @@ -51,7 +50,7 @@ func (player *Player) Play(song *Song) { return } - llog.Info(fmt.Sprintf("Start playing %v", song)) + llog.Info("Start playing %v", song) player.Backends[song.Source].Play(song, player) } @@ -69,7 +68,7 @@ func (player *Player) runMpv() { } func (player *Player) PlayUri(uri string) { - llog.Info(fmt.Sprintf("Start mpv with %s", uri)) + llog.Info("Start mpv with %s", uri) player.mpv = exec.Command("mpv", "--no-video", uri) go player.runMpv() } @@ -89,7 +88,7 @@ func (player *Player) PlayData(data io.Reader) { defer stdin.Close() if _, err := io.Copy(stdin, data); err != nil { - llog.Fatal(fmt.Sprintf("Failed to write song data to mpv (%v)", err)) + llog.Fatal("Failed to write song data to mpv (%v)", err) } }() |
