From 8229edb3cdeda68dd62141164eae46002dd6b307 Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Fri, 30 Sep 2022 22:33:48 +0800 Subject: [PATCH] Log a message if capture logs env var is malformed --- main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 6e43626e..5cd56ba1 100644 --- a/main.go +++ b/main.go @@ -47,9 +47,15 @@ func main() { app.WithAWSConfig(cfg), } - captureLogs, err := strconv.ParseBool(os.Getenv("ELASTIC_APM_LAMBDA_CAPTURE_LOGS")) - // Default capture function logs to true + // ELASTIC_APM_LAMBDA_CAPTURE_LOGS indicate if the lambda extension + // should capture logs, the value defaults to true i.e. the extension + // will capture function logs by default + rawLambdaCaptureLogs := os.Getenv("ELASTIC_APM_LAMBDA_CAPTURE_LOGS") + captureLogs, err := strconv.ParseBool(rawLambdaCaptureLogs) if err != nil { + if rawLambdaCaptureLogs != "" { + log.Printf("failed to parse env var ELASTIC_APM_LAMBDA_CAPTURE_LOGS, defaulting to true") + } captureLogs = true }