From 051671036c83feed9ceabcf5e0b87def789c1ece Mon Sep 17 00:00:00 2001 From: Nils Date: Fri, 24 Dec 2021 01:51:57 +0100 Subject: [PATCH] tweak logging --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index c86188f..8f7d086 100644 --- a/main.go +++ b/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) }