Fixed some logging stuff

This commit is contained in:
Saxon Milton 2018-04-22 14:04:48 +09:30
parent d1e49e795b
commit 7edf430f9a
1 changed files with 8 additions and 8 deletions

View File

@ -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 // logger provided in the revid config - if there is one, otherwise the message
// is sent to stdout // is sent to stdout
func (r *revid) Log(logType, m string) { func (r *revid) Log(logType, m string) {
if r.config.Logger != nil { if r.config.Verbosity == Yes {
r.config.Logger.Log(logType, m) if r.config.Logger != nil {
} else { r.config.Logger.Log(logType, m)
if r.config.Verbosity == Yes { return
fmt.Println(logType + ": " + m)
} }
fmt.Println(logType + ": " + m
} }
} }
@ -326,11 +326,11 @@ func (r *revid) packClips() {
} }
} }
func reboot() { func (r* revid)reboot() {
cmd := exec.Command("sudo", "reboot") cmd := exec.Command("sudo", "reboot")
err := cmd.Run() err := cmd.Run()
fmt.Println(err) r.Log(Error, err.Error())
fmt.Println("Rebooting!") r.Log(Info, "Rebooting!")
} }
// outputClips takes the clips produced in the packClips method and outputs them // outputClips takes the clips produced in the packClips method and outputs them