From 370a0233dc84e703a743bb41367d0473b027aa7d Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Mon, 27 Nov 2023 21:48:45 +0000 Subject: [PATCH 1/2] Updated go doc to make it clear InferLevelsWithTimestamp relies on InferLevels being true --- logger.go | 1 + 1 file changed, 1 insertion(+) diff --git a/logger.go b/logger.go index 947ac0c..b7d5a94 100644 --- a/logger.go +++ b/logger.go @@ -233,6 +233,7 @@ type StandardLoggerOptions struct { // [DEBUG] and strip it off before reapplying it. // The timestamp detection may result in false positives and incomplete // string outputs. + // InferLevelsWithTimestamp is only relevant if InferLevels is true. InferLevelsWithTimestamp bool // ForceLevel is used to force all output from the standard logger to be at From 748cdbc428a718e290a608dfc7e883c95f107a98 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Mon, 27 Nov 2023 21:54:05 +0000 Subject: [PATCH 2/2] Tweak README --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 21a17c5..983d44c 100644 --- a/README.md +++ b/README.md @@ -140,9 +140,10 @@ log.Printf("[DEBUG] %d", 42) ... [DEBUG] my-app: 42 ``` -Notice that if `appLogger` is initialized with the `INFO` log level _and_ you +Notice that if `appLogger` is initialized with the `INFO` log level, _and_ you specify `InferLevels: true`, you will not see any output here. You must change `appLogger` to `DEBUG` to see output. See the docs for more information. If the log lines start with a timestamp you can use the -`InferLevelsWithTimestamp` option to try and ignore them. +`InferLevelsWithTimestamp` option to try and ignore them. Please note that in order +for `InferLevelsWithTimestamp` to be relevant, `InferLevels` must be set to `true`.