aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarvey Tindall <hrfee@protonmail.ch>2020-08-31 20:37:23 +0100
committerHarvey Tindall <hrfee@protonmail.ch>2020-08-31 20:37:23 +0100
commit6ed1eb428f2941b6a5ea603781f6406c221a8087 (patch)
tree655d900cc7a0a5feeb62caa5c1f38d3d6fc22169
parentf4090c1f0711b211ab54ba7eb2e43b3e4ea5e0ca (diff)
downloadwaybar-mpris-6ed1eb428f2941b6a5ea603781f6406c221a8087.tar.gz
waybar-mpris-6ed1eb428f2941b6a5ea603781f6406c221a8087.zip
log to /tmp/waybar-mpris.log
-rw-r--r--main.go9
-rwxr-xr-xwaybar-mprisbin968532 -> 970148 bytes
2 files changed, 9 insertions, 0 deletions
diff --git a/main.go b/main.go
index 436e65d..dd196b2 100644
--- a/main.go
+++ b/main.go
@@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"fmt"
+ "io"
"io/ioutil"
"log"
"net"
@@ -44,6 +45,7 @@ const (
// PropertiesChanged
MATCH_PC = "type='signal',path='/org/mpris/MediaPlayer2',interface='org.freedesktop.DBus.Properties'"
SOCK = "/tmp/waybar-mpris.sock"
+ LOGFILE = "/tmp/waybar-mpris.log"
)
var (
@@ -352,6 +354,13 @@ func (pl *PlayerList) Toggle() {
}
func main() {
+ logfile, err := os.OpenFile(LOGFILE, os.O_CREATE|os.O_APPEND|os.O_RDWR, 0666)
+ if err != nil {
+ log.Fatalf("Couldn't open %s for writing: %s", LOGFILE, err)
+ }
+ mw := io.MultiWriter(logfile, os.Stdout)
+ log.SetOutput(mw)
+ os.Stderr = logfile
flag.StringVar(&PLAY, "play", PLAY, "Play symbol/text to use.")
flag.StringVar(&PAUSE, "pause", PAUSE, "Pause symbol/text to use.")
flag.StringVar(&SEP, "separator", SEP, "Separator string to use between artist, album, and title.")
diff --git a/waybar-mpris b/waybar-mpris
index 9f338fc..c450ef3 100755
--- a/waybar-mpris
+++ b/waybar-mpris
Binary files differ