From 3b3a73c467840eb7f6ffe875d296aaf55f5f5079 Mon Sep 17 00:00:00 2001 From: Narthana Epa Date: Wed, 29 Nov 2023 17:30:17 +1100 Subject: [PATCH] Allow env vars to control debug logging for the lambda --- lambda/main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lambda/main.go b/lambda/main.go index 0cbfc46d..a15ff405 100644 --- a/lambda/main.go +++ b/lambda/main.go @@ -57,6 +57,12 @@ func Handler(ctx context.Context, evt json.RawMessage) (string, error) { quiet := quietString == "1" || quietString == "true" timeout := os.Getenv("BUILDKITE_AGENT_METRICS_TIMEOUT") + debugEnvVar := os.Getenv("BUILDKITE_AGENT_METRICS_DEBUG") + debug := debugEnvVar == "1" || debugEnvVar == "true" + + debugHTTPEnvVar := os.Getenv("BUILDKITE_AGENT_METRICS_DEBUG_HTTP") + debugHTTP := debugHTTPEnvVar == "1" || debugHTTPEnvVar == "true" + if quiet { log.SetOutput(io.Discard) } @@ -108,8 +114,8 @@ func Handler(ctx context.Context, evt json.RawMessage) (string, error) { Token: token, Queues: queues, Quiet: quiet, - Debug: false, - DebugHttp: false, + Debug: debug, + DebugHttp: debugHTTP, Timeout: configuredTimeout, }) }