summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/server4/logger_test.go
blob: c33d83e39eb517fd70bc5f02ff6e684422797faf (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
41
42
// +build go1.12

package server4

import(
	"log"
	"os"
	"testing"

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

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

func TestShortSummaryLogger(t *testing.T) {
	l := ShortSummaryLogger{
		Printfer: log.New(os.Stderr, "[dhcpv4] ", log.LstdFlags),
	}
	msg, err := dhcpv4.New()
	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, "[dhcpv4] ", log.LstdFlags),
	}
	msg, err := dhcpv4.New()
	require.Nil(t, err)
	require.NotNil(t, msg)
	l.Printf("test")
	l.PrintMessage("prefix", msg)
}