File: setup_test.go

package info (click to toggle)
golang-github-chainguard-dev-clog 1.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 424 kB
  • sloc: makefile: 4
file content (19 lines) | stat: -rw-r--r-- 561 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package gcp

import (
	"context"
	"log/slog"
	"testing"
)

func TestHandler(t *testing.T) {
	ctx := context.Background()
	l := slog.New(NewHandler(slog.LevelInfo))
	l.With("level", "INFO").Log(ctx, slog.LevelInfo, "hello world") // okay
	l.With("level", "INFO").Log(ctx, slog.LevelWarn, "hello world") // weird, but okay (info)

	// These should not panic.
	l.With("level", nil).Log(ctx, slog.LevelInfo, "hello world")
	l.With("level", 123).Log(ctx, slog.LevelInfo, "hello world")
	l.With("level", map[string]string{}).Log(ctx, slog.LevelInfo, "hello world")
}