photoprism/pkg/sev/logrus.go
Michael Mayer 3c4cc40882 Security: Refactor log levels and events #98
Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-10-10 16:34:07 +02:00

21 lines
399 B
Go

package sev
import "github.com/sirupsen/logrus"
// LogLevel takes a logrus log level and returns the severity.
func LogLevel(lvl logrus.Level) Level {
switch lvl {
case logrus.PanicLevel:
return Alert
case logrus.FatalLevel:
return Critical
case logrus.ErrorLevel:
return Error
case logrus.WarnLevel:
return Warning
case logrus.InfoLevel:
return Info
default:
return Debug
}
}