package logger_test import ( "sync" "testing" "git.schreifuchs.ch/schreifuchs/logger" "git.schreifuchs.ch/schreifuchs/logger/lvl" ) func TestNewWith(t *testing.T) { var wg sync.WaitGroup expected := "Hello World" got := "" wg.Add(1) l := logger.NewWithStrategy(lvl.Debug, func(c <-chan *logger.Log) { for m := range c { got = m.Message wg.Done() } }) l.Debug(expected) wg.Wait() if expected != got { t.Errorf("Expected %s but got %s", expected, got) } }