Commit 2d4b1ad
committed
feat!: introduce logger choice via slog
Historically brokerapi has required use of the
[`lager`](https://github.com/cloudfoundry/lager) logger. In Go 1.21,
structured logging was introduced into the Go standard library via the
[`log/slog`](https://pkg.go.dev/log/slog) package, and `slog`
[compatability was added](cloudfoundry/lager@4bf4955)
to `lager`.
`brokerapi` has been modified to require a `slog` logger to be passed
rather than a `lager` logger. This allows users a choice of logger.
Users who still want to use lager can easily do that using the
lager/slog compatability:
```go
logger := lager.NewLogger(name)
brokerAPI := brokerapi.New(serviceBroker, slog.New(lager.NewHandler(logger)), credentials)
```
And users who want to use `slog` or an `slog`-compatible logger can do
that instead.
A key advantage is that `lager` is no longer a dependency of this
package, which simplifies package management for apps that use brokerapi
and other libraries which use `lager`.1 parent 4b27d1c commit 2d4b1ad
File tree
27 files changed
+358
-301
lines changed- .github/workflows
- domain/apiresponses
- handlers
- internal/logutil
- middlewares
- utils
27 files changed
+358
-301
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
0 commit comments