mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-29 03:58:38 +00:00
- 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.
47 lines
667 B
Go
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())
|
|
})
|
|
}
|
|
}
|