tweak logging

This commit is contained in:
Nils 2021-12-24 01:51:57 +01:00
parent 053b958a60
commit 051671036c
Signed by: byreqz
GPG Key ID: 396A62D7D436749E

View File

@ -13,6 +13,8 @@ var logstdout = log.New()
var logfile = log.New()
func init() {
logstdout.SetFormatter(&log.TextFormatter{
FullTimestamp: true})
logstdout.SetOutput(os.Stdout)
logstdout.SetLevel(log.WarnLevel)
@ -38,13 +40,13 @@ func runner(remoteip string, command string, args... string) string{
"remote_ip": remoteip,
"command": fmt.Sprint(command, args),
"error": err.Error(),
}).Warn("the following request failed:")
}).Warn("request failed:")
}
} else {
logfile.WithFields(log.Fields{
"remote_ip": remoteip,
"command": fmt.Sprint(command, args),
}).Info("the following request was issued without error")
}).Info("request succeeded:")
}
return string(cmd)
}