Skip to content

Commit 3d50de2

Browse files
author
Evan Phoenix
authored
Merge pull request #135 from hashicorp/peteski22/docs/standard-logger-options-infer-levels-with-timestamp
Docs: InferLevelsWithTimestamp relies on InferLevels being true
2 parents f7ed9e4 + 748cdbc commit 3d50de2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ log.Printf("[DEBUG] %d", 42)
140140
... [DEBUG] my-app: 42
141141
```
142142

143-
Notice that if `appLogger` is initialized with the `INFO` log level _and_ you
143+
Notice that if `appLogger` is initialized with the `INFO` log level, _and_ you
144144
specify `InferLevels: true`, you will not see any output here. You must change
145145
`appLogger` to `DEBUG` to see output. See the docs for more information.
146146

147147
If the log lines start with a timestamp you can use the
148-
`InferLevelsWithTimestamp` option to try and ignore them.
148+
`InferLevelsWithTimestamp` option to try and ignore them. Please note that in order
149+
for `InferLevelsWithTimestamp` to be relevant, `InferLevels` must be set to `true`.

logger.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ type StandardLoggerOptions struct {
233233
// [DEBUG] and strip it off before reapplying it.
234234
// The timestamp detection may result in false positives and incomplete
235235
// string outputs.
236+
// InferLevelsWithTimestamp is only relevant if InferLevels is true.
236237
InferLevelsWithTimestamp bool
237238

238239
// ForceLevel is used to force all output from the standard logger to be at

0 commit comments

Comments
 (0)