Files
atlantis/server/user_config_test.go
Luke Kysow c4f89958d3 Tweak logging. Add timezone, use everywhere.
- Use logger for all warnings. Previously we were writing warnings from
cmd/server.go directly to stderr which bypassed our normal log format.
- Add the timezone to log output. This is just really nice to have if
you're looking at old logs.
- Change levels to all be 4 characters: DBUG, INFO, WARN, EROR. This
makes the logs easier to read because it lines up.
- Log when we first receive the request as well as when we send a
response. This makes it easier to see where the request starts and ends.
2018-12-19 13:40:13 -06:00

47 lines
667 B
Go

package server_test
import (
"testing"
"github.com/runatlantis/atlantis/server"
"github.com/runatlantis/atlantis/server/logging"
. "github.com/runatlantis/atlantis/testing"
)
func TestUserConfig_ToLogLevel(t *testing.T) {
cases := []struct {
userLvl string
expLvl logging.LogLevel
}{
{
"debug",
logging.Debug,
},
{
"info",
logging.Info,
},
{
"warn",
logging.Warn,
},
{
"error",
logging.Error,
},
{
"unknown",
logging.Info,
},
}
for _, c := range cases {
t.Run(c.userLvl, func(t *testing.T) {
u := server.UserConfig{
LogLevel: c.userLvl,
}
Equals(t, c.expLvl, u.ToLogLevel())
})
}
}