File: writer_test.go

package info (click to toggle)
golang-github-spiffe-go-spiffe 2.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,116 kB
  • sloc: makefile: 157
file content (26 lines) | stat: -rw-r--r-- 416 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package logger_test

import (
	"bytes"
	"testing"

	"github.com/spiffe/go-spiffe/v2/logger"
	"github.com/stretchr/testify/require"
)

func TestWriter(t *testing.T) {
	buf := new(bytes.Buffer)

	log := logger.Writer(buf)

	log.Debugf("%s", "debug")
	log.Warnf("%s", "warn")
	log.Infof("%s", "info")
	log.Errorf("%s", "error")

	require.Equal(t, `[DEBUG] debug
[WARN] warn
[INFO] info
[ERROR] error
`, buf.String())
}