From 7edf430f9ad0e63d812ab6c10c45b7267f7ab448 Mon Sep 17 00:00:00 2001 From: Saxon Milton Date: Sun, 22 Apr 2018 14:04:48 +0930 Subject: [PATCH] Fixed some logging stuff --- revid/Revid.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/revid/Revid.go b/revid/Revid.go index 85b19573..e809bfab 100644 --- a/revid/Revid.go +++ b/revid/Revid.go @@ -219,12 +219,12 @@ func (r *revid) ChangeConfig(config Config) (err error) { // logger provided in the revid config - if there is one, otherwise the message // is sent to stdout func (r *revid) Log(logType, m string) { - if r.config.Logger != nil { - r.config.Logger.Log(logType, m) - } else { - if r.config.Verbosity == Yes { - fmt.Println(logType + ": " + m) + if r.config.Verbosity == Yes { + if r.config.Logger != nil { + r.config.Logger.Log(logType, m) + return } + fmt.Println(logType + ": " + m } } @@ -326,11 +326,11 @@ func (r *revid) packClips() { } } -func reboot() { +func (r* revid)reboot() { cmd := exec.Command("sudo", "reboot") err := cmd.Run() - fmt.Println(err) - fmt.Println("Rebooting!") + r.Log(Error, err.Error()) + r.Log(Info, "Rebooting!") } // outputClips takes the clips produced in the packClips method and outputs them