package main import ( log "github.com/Sirupsen/logrus" "testing" ) func TestSetupLogging(t *testing.T) { for i, test := range []struct { format string level string expected string }{ {"text", "warning", "warning"}, {"json", "debug", "debug"}, {"text", "info", "info"}, {"json", "error", "error"}, {"text", "something", "warning"}, } { setupLogging(test.format, test.level) if log.GetLevel().String() != test.expected { t.Errorf("Test %d: Expected loglevel %s but got %s", i, test.expected, log.GetLevel().String()) } } }