summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/server6/logger_test.go
blob: 1ffacb7bfd172a7bd57669f284fba3b2727cb482 (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package server6

import(
	"log"
	"os"
	"testing"

	"github.com/insomniacslk/dhcp/dhcpv6"
	"github.com/stretchr/testify/require"
)

func TestEmptyLogger(t *testing.T) {
	l := EmptyLogger{}
	msg, err := dhcpv6.NewMessage()
	require.Nil(t, err)
	l.Printf("test")
	l.PrintMessage("prefix", msg)
}

func TestShortSummaryLogger(t *testing.T) {
	l := ShortSummaryLogger{
		Printfer: log.New(os.Stderr, "[dhcpv6] ", log.LstdFlags),
	}
	msg, err := dhcpv6.NewMessage()
	require.Nil(t, err)
	require.NotNil(t, msg)
	l.Printf("test")
	l.PrintMessage("prefix", msg)
}

func TestDebugLogger(t *testing.T) {
	l := DebugLogger{
		Printfer: log.New(os.Stderr, "[dhcpv6] ", log.LstdFlags),
	}
	msg, err := dhcpv6.NewMessage()
	require.Nil(t, err)
	require.NotNil(t, msg)
	l.Printf("test")
	l.PrintMessage("prefix", msg)
}