From 004eb29173633bb1e2d59fe0857a1005f9f9b373 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 15 Jul 2021 10:55:41 -0500 Subject: [PATCH] Add tip about being able to debug a bunch of variables without formatting hassle --- ONBOARDING.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ONBOARDING.md b/ONBOARDING.md index 0e073f85..d776b07a 100644 --- a/ONBOARDING.md +++ b/ONBOARDING.md @@ -163,6 +163,15 @@ There is no syntactically pleasing way to do this. Create a separate function wh This is done using standard Go testing mechanisms, use `t.Logf(...)` which will be logged only if the test fails or if `-v` is set. Note that you will not need to log HTTP requests performed using one of the built in deployment clients as they are already wrapped in loggers. For full HTTP logs, use `COMPLEMENT_DEBUG=1`. +For debugging, you can also use `logrus` to expand a bunch of variables: + +```go +logrus.WithFields(logrus.Fields{ + "events": events, + "context": context, +}).Error("message response") +``` + ### How do I skip a test? Use one of `t.Skipf(...)` or `t.SkipNow()`.