databricks-cli/libs/log
Pieter Noordhuis 60a8abdcd7
Rewrite the friendly log handler (#1038)
## Changes

It wasn't working because it deferred to the regular `slog.TextHandler`
for the `WithAttr` and `WithGroup` functions. Both of these functions
don't mutate the handler but return a new one. When the top-level logger
called one of these, log records in that context used the standard
handler instead of ours.

To implement tracking of attributes and groups, I followed the guide at
https://github.com/golang/example/blob/master/slog-handler-guide/README.md
for writing custom handlers.

## Tests

The new tests demonstrate formatting through `t.Log` and look good.
2023-12-01 12:17:04 +00:00
..
handler Rewrite the friendly log handler (#1038) 2023-12-01 12:17:04 +00:00
context.go Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
levels.go Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
logger.go Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
replace_attr.go Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
replace_attr_test.go Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
sdk.go Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
source.go Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
source_test.go Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00