| 1 |
package gcp |
| 2 |
|
| 3 |
import ( |
| 4 |
"context" |
| 5 |
"log/slog" |
| 6 |
"testing" |
| 7 |
) |
| 8 |
|
| 9 |
func TestHandler(t *testing.T) { |
| 10 |
ctx := context.Background() |
| 11 |
l := slog.New(NewHandler(slog.LevelInfo)) |
| 12 |
l.With("level", "INFO").Log(ctx, slog.LevelInfo, "hello world") |
| 13 |
l.With("level", "INFO").Log(ctx, slog.LevelWarn, "hello world") |
| 14 |
|
| 15 |
|
| 16 |
l.With("level", nil).Log(ctx, slog.LevelInfo, "hello world") |
| 17 |
l.With("level", 123).Log(ctx, slog.LevelInfo, "hello world") |
| 18 |
l.With("level", map[string]string{}).Log(ctx, slog.LevelInfo, "hello world") |
| 19 |
} |