Merge pull request #103028 from serathius/example-caller

Update logging example with caller
This commit is contained in:
Kubernetes Prow Robot 2021-06-21 20:44:10 -07:00 committed by GitHub
commit f4e7828674
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,11 +29,11 @@ go run ./staging/src/k8s.io/component-base/logs/example/cmd/logger.go --logging-
Expected output:
```
{"ts":1622923409719.5137,"msg":"Log using Infof, key: value\n","v":0}
{"ts":1622923409719.5403,"msg":"Log using InfoS","v":0,"key":"value"}
{"ts":1622923409719.6025,"msg":"Log using Errorf, err: fail\n","v":0}
{"ts":1622923409719.6077,"msg":"Log using ErrorS","err":"fail","v":0}
{"ts":1622923409719.6467,"msg":"Log with sensitive key, data: {\"secret\"}\n","v":0}
{"ts":1624215726270.3562,"caller":"cmd/logger.go:58","msg":"Log using Infof, key: value\n","v":0}
{"ts":1624215726270.4377,"caller":"cmd/logger.go:59","msg":"Log using InfoS","v":0,"key":"value"}
{"ts":1624215726270.6724,"caller":"cmd/logger.go:61","msg":"Log using Errorf, err: fail\n","v":0}
{"ts":1624215726270.7566,"caller":"cmd/logger.go:62","msg":"Log using ErrorS","err":"fail","v":0}
{"ts":1624215726270.8428,"caller":"cmd/logger.go:64","msg":"Log with sensitive key, data: {\"secret\"}\n","v":0}
```
## Logging sanitization