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
// 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