Logger returns a logger suitable for use in tests. Defaults to informational verbosity. If env is set with `RIVER_DEBUG=true`, debug level verbosity is activated.
(tb testing.TB)
| 195 | // Defaults to informational verbosity. If env is set with `RIVER_DEBUG=true`, |
| 196 | // debug level verbosity is activated. |
| 197 | func Logger(tb testing.TB) *slog.Logger { |
| 198 | tb.Helper() |
| 199 | |
| 200 | if os.Getenv("RIVER_DEBUG") == "1" || os.Getenv("RIVER_DEBUG") == "true" { |
| 201 | return slogtest.NewLogger(tb, &slog.HandlerOptions{Level: slog.LevelDebug}) |
| 202 | } |
| 203 | |
| 204 | return slogtest.NewLogger(tb, nil) |
| 205 | } |
| 206 | |
| 207 | // LoggerWarn returns a logger suitable for use in tests which outputs only at |
| 208 | // warn or above. Useful in tests where particularly noisy log output is |
searching dependent graphs…