mirror of
https://github.com/goauthentik/authentik
synced 2026-04-27 09:57:31 +02:00
* core: bump library/golang in /lifecycle/container Bumps library/golang from 1.25.5-trixie to 1.26.0-trixie. --- updated-dependencies: - dependency-name: library/golang dependency-version: 1.26.0-trixie dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * bump & fix Signed-off-by: Jens Langhammer <jens@goauthentik.io> * bump docs too Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package postgresstore
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
gormlogger "gorm.io/gorm/logger"
|
|
)
|
|
|
|
type logrusLogger struct {
|
|
logger *log.Entry
|
|
}
|
|
|
|
func NewLogger(parent *log.Entry) *logrusLogger {
|
|
return &logrusLogger{
|
|
logger: parent,
|
|
}
|
|
}
|
|
|
|
func (l *logrusLogger) LogMode(gormlogger.LogLevel) gormlogger.Interface {
|
|
return l
|
|
}
|
|
|
|
func (l *logrusLogger) Info(ctx context.Context, s string, args ...any) {
|
|
l.logger.WithContext(ctx).Infof(s, args...)
|
|
}
|
|
|
|
func (l *logrusLogger) Warn(ctx context.Context, s string, args ...any) {
|
|
l.logger.WithContext(ctx).Warnf(s, args...)
|
|
}
|
|
|
|
func (l *logrusLogger) Error(ctx context.Context, s string, args ...any) {
|
|
l.logger.WithContext(ctx).Errorf(s, args...)
|
|
}
|
|
|
|
func (l *logrusLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {
|
|
elapsed := time.Since(begin)
|
|
sql, _ := fc()
|
|
fields := log.Fields{
|
|
"elapsed": elapsed,
|
|
}
|
|
if err != nil {
|
|
l.logger.WithContext(ctx).WithFields(fields).WithError(err).Error(sql)
|
|
return
|
|
}
|
|
l.logger.WithContext(ctx).WithFields(fields).Trace(sql)
|
|
}
|