mirror of
https://github.com/byReqz/probehost2.git
synced 2024-11-14 19:23:14 +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()
|
var logfile = log.New()
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
logstdout.SetFormatter(&log.TextFormatter{
|
||||||
|
FullTimestamp: true})
|
||||||
logstdout.SetOutput(os.Stdout)
|
logstdout.SetOutput(os.Stdout)
|
||||||
logstdout.SetLevel(log.WarnLevel)
|
logstdout.SetLevel(log.WarnLevel)
|
||||||
|
|
||||||
@ -38,13 +40,13 @@ func runner(remoteip string, command string, args... string) string{
|
|||||||
"remote_ip": remoteip,
|
"remote_ip": remoteip,
|
||||||
"command": fmt.Sprint(command, args),
|
"command": fmt.Sprint(command, args),
|
||||||
"error": err.Error(),
|
"error": err.Error(),
|
||||||
}).Warn("the following request failed:")
|
}).Warn("request failed:")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logfile.WithFields(log.Fields{
|
logfile.WithFields(log.Fields{
|
||||||
"remote_ip": remoteip,
|
"remote_ip": remoteip,
|
||||||
"command": fmt.Sprint(command, args),
|
"command": fmt.Sprint(command, args),
|
||||||
}).Info("the following request was issued without error")
|
}).Info("request succeeded:")
|
||||||
}
|
}
|
||||||
return string(cmd)
|
return string(cmd)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user