mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
828f565290
This is going to be the v4. Expected improvements: - More reliable due to static typing. - Bump of performance. - Improvement of logging. - Authelia can be shipped as a single binary. - Will likely work on ARM architecture.
26 lines
600 B
Go
26 lines
600 B
Go
package logging
|
|
|
|
import (
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/valyala/fasthttp"
|
|
)
|
|
|
|
// Logger return the standard logrues logger.
|
|
func Logger() *logrus.Logger {
|
|
return logrus.StandardLogger()
|
|
}
|
|
|
|
// NewRequestLogger create a new request logger for the given request.
|
|
func NewRequestLogger(ctx *fasthttp.RequestCtx) *logrus.Entry {
|
|
return logrus.WithFields(logrus.Fields{
|
|
"method": string(ctx.Method()),
|
|
"path": string(ctx.Path()),
|
|
"remote_ip": ctx.RemoteIP().String(),
|
|
})
|
|
}
|
|
|
|
// SetLevel set the level of the logger.
|
|
func SetLevel(level logrus.Level) {
|
|
logrus.SetLevel(level)
|
|
}
|