File: init_test.go

package info (click to toggle)
golang-github-mgutz-logxi 1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 524 kB
  • sloc: makefile: 7
file content (26 lines) | stat: -rw-r--r-- 483 bytes parent folder | download
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 log

import (
	"bytes"
	"os"
	"testing"

	"github.com/stretchr/testify/assert"
)

var testBuf bytes.Buffer

var testInternalLog Logger

func init() {
	testInternalLog = NewLogger3(&testBuf, "__logxi", NewTextFormatter("__logxi"))
	testInternalLog.SetLevel(LevelError)
}

func TestUnknownLevel(t *testing.T) {
	testResetEnv()
	os.Setenv("LOGXI", "*=oy")
	processEnv()
	buffer := testBuf.String()
	assert.Contains(t, buffer, "Unknown level", "should error on unknown level")
}