authelia/internal/logging/logger.go

23 lines
527 B
Go
Raw Normal View History

package logging
import (
2019-11-17 02:50:58 +07:00
logrus_stack "github.com/Gurpartap/logrus-stack"
"github.com/sirupsen/logrus"
)
2019-11-17 02:50:58 +07:00
func init() {
callerLevels := []logrus.Level{}
stackLevels := []logrus.Level{logrus.PanicLevel, logrus.FatalLevel, logrus.ErrorLevel}
logrus.AddHook(logrus_stack.NewHook(callerLevels, stackLevels))
}
// Logger return the standard logrus logger.
func Logger() *logrus.Logger {
return logrus.StandardLogger()
}
// SetLevel set the level of the logger.
func SetLevel(level logrus.Level) {
logrus.SetLevel(level)
}