github.com/phuslu/log@v1.0.100/eventlog_test.go (about) 1 //go:build windows 2 // +build windows 3 4 package log 5 6 import ( 7 "testing" 8 ) 9 10 func TestEventlogWriter(t *testing.T) { 11 w := &EventlogWriter{ 12 Source: ".NET Runtime", 13 ID: 1000, 14 } 15 16 for _, level := range []string{"trace", "debug", "info", "warning", "error", "fatal", "panic", "hahaha"} { 17 _, err := wlprintf(w, ParseLevel(level), `{"time":"2019-07-10T05:35:54.277Z","level":"%s","caller":"test.go:42","error":"i am test error","foo":"bar","n":42,"message":"hello json eventlog writer"}`+"\n", level) 18 if err != nil { 19 t.Errorf("test json eventlog writer error: %+v", err) 20 } 21 } 22 }