Rename log.LevelCritical to log.LevelFatal

This commit is contained in:
Deluan 2022-12-21 14:53:36 -05:00
parent 28389fb05e
commit 5943e8f953
26 changed files with 40 additions and 46 deletions

View file

@ -41,12 +41,12 @@ var redacted = &Hook{
}
const (
LevelCritical = Level(logrus.FatalLevel) // TODO Rename to LevelFatal
LevelError = Level(logrus.ErrorLevel)
LevelWarn = Level(logrus.WarnLevel)
LevelInfo = Level(logrus.InfoLevel)
LevelDebug = Level(logrus.DebugLevel)
LevelTrace = Level(logrus.TraceLevel)
LevelFatal = Level(logrus.FatalLevel)
LevelError = Level(logrus.ErrorLevel)
LevelWarn = Level(logrus.WarnLevel)
LevelInfo = Level(logrus.InfoLevel)
LevelDebug = Level(logrus.DebugLevel)
LevelTrace = Level(logrus.TraceLevel)
)
type contextKey string
@ -82,8 +82,8 @@ func levelFromString(l string) Level {
envLevel := strings.ToLower(l)
var level Level
switch envLevel {
case "critical":
level = LevelCritical
case "fatal":
level = LevelFatal
case "error":
level = LevelError
case "warn":
@ -147,7 +147,7 @@ func CurrentLevel() Level {
}
func Fatal(args ...interface{}) {
log(LevelCritical, args...)
log(LevelFatal, args...)
os.Exit(1)
}

View file

@ -167,9 +167,9 @@ var _ = Describe("Logger", func() {
})
Describe("SetLevelString", func() {
It("converts Critical level", func() {
SetLevelString("Critical")
Expect(CurrentLevel()).To(Equal(LevelCritical))
It("converts Fatal level", func() {
SetLevelString("Fatal")
Expect(CurrentLevel()).To(Equal(LevelFatal))
})
It("converts Error level", func() {
SetLevelString("ERROR")