From e253f6e21ddf794539308878c77b810c7eca2d5e Mon Sep 17 00:00:00 2001 From: itchyny Date: Fri, 20 Jul 2018 11:31:19 +0900 Subject: [PATCH] improve debug messages for check monitoring actions --- command/command.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/command/command.go b/command/command.go index 33d9192c3..6cd330655 100644 --- a/command/command.go +++ b/command/command.go @@ -415,10 +415,13 @@ func runChecker(checker *checks.Checker, checkReportCh chan *checks.Report, repo if checker.Config.Action != nil { env := []string{fmt.Sprintf("MACKEREL_STATUS=%s", report.Status), fmt.Sprintf("MACKEREL_PREVIOUS_STATUS=%s", lastStatus)} go func() { - _, stderr, _, _ := checker.Config.Action.RunWithEnv(env) + logger.Debugf("Checker %q action: %q env: %+v", checker.Name, checker.Config.Action.CommandString(), env) + stdout, stderr, exitCode, _ := checker.Config.Action.RunWithEnv(env) if stderr != "" { - logger.Warningf("Checker %q action output stderr: %s", checker.Name, stderr) + logger.Warningf("Checker %q action stdout: %q stderr: %q exitCode: %d", checker.Name, stdout, stderr, exitCode) + } else { + logger.Debugf("Checker %q action stdout: %q exitCode: %d", checker.Name, stdout, exitCode) } }() }