mirror of
https://github.com/byReqz/probehost2.git
synced 2024-12-25 12:21:48 +00:00
tweak logging
This commit is contained in:
parent
053b958a60
commit
051671036c
6
main.go
6
main.go
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user