* chore(deps): consolidate dependency and security bumps Dependabot PRs applied: - #12878 qs 6.15.2 -> 6.16.0 (web/web-runtime) - #13013 alpine 3.24.1 -> 3.24.2 - #13061 actions/checkout -> v7.0.1 (missed instance in k8s.yml) - #13062 actions/setup-node -> v7.0.0 (missed instance in k8s.yml) - #13075 simple-git 3.36.0 -> 4.0.1 (security) - #13076 katex 0.16.45 -> 0.18.2+ (security) - #13077 dompurify 3.4.13 -> 3.4.16 (security) - #13079 go deps minor-and-patch group, 18 updates (opa 1.19.0 -> 1.21.1, otel 1.46 -> 1.47, bleve, govips, grpc-gateway, lico, tablewriter, logrus, gjson, x/exp, x/image, genproto, etc.) Skipped (already satisfied on master): #12513, #12624, #12625, #12633 Manual security bumps via pnpm.overrides (no dependabot PR existed): - axios -> 1.20.0 - smol-toml -> 1.9.0 - postcss -> 8.5.23 - postcss-selector-parser -> 7.1.6 - colord -> 2.9.4 - unhead -> 2.1.13 - markdown-it -> 14.3.1 - esbuild -> 0.28.1 - brace-expansion 5.0.11 -> 5.0.12 Not fixable: sprintf-js and elliptic have no patched version released upstream yet; left as-is. go build and pnpm install verified clean. * chore(deps): fix residual transitive vulns found by trivy trivy flagged duplicate/stale resolutions that survived the earlier override pass: dompurify (3.4.12 -> 3.4.16), qs (6.14.2 -> 6.16.0), and fast-uri (3.1.7 -> 3.1.8, CVE-2026-86472). Added/bumped pnpm.overrides accordingly. trivy fs scan of web/pnpm-lock.yaml now clean. * chore(deps): bump reva to bac0e1ee144ab853a81c6b02142032f102dd245a Pins github.com/owncloud/reva/v2 to bac0e1ee144ab853a81c6b02142032f102dd245a, pulling in its go-playground/locales and huandu/xstrings version bumps. Appends this PR to changelog/unreleased/bump-reva.md. go build ./... verified clean after go mod vendor resync. * fix(ci): revert unhead override, breaks web build * revert: keep k8s.yml actions/checkout and setup-node pinned
266 lines
6.8 KiB
Go
266 lines
6.8 KiB
Go
package logrus
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
// std is the package-level standard logger, similar to the default logger
|
|
// in the stdlib [log] package.
|
|
var std = New()
|
|
|
|
// StandardLogger returns the package-level standard logger used by
|
|
// the top-level logging functions.
|
|
func StandardLogger() *Logger {
|
|
return std
|
|
}
|
|
|
|
// SetOutput sets the standard logger output.
|
|
func SetOutput(out io.Writer) {
|
|
std.SetOutput(out)
|
|
}
|
|
|
|
// SetFormatter sets the standard logger formatter.
|
|
func SetFormatter(formatter Formatter) {
|
|
std.SetFormatter(formatter)
|
|
}
|
|
|
|
// SetReportCaller sets whether the standard logger will include the calling
|
|
// method as a field.
|
|
func SetReportCaller(include bool) {
|
|
std.SetReportCaller(include)
|
|
}
|
|
|
|
// SetLevel sets the standard logger level.
|
|
func SetLevel(level Level) {
|
|
std.SetLevel(level)
|
|
}
|
|
|
|
// GetLevel returns the standard logger level.
|
|
func GetLevel() Level {
|
|
return std.GetLevel()
|
|
}
|
|
|
|
// IsLevelEnabled checks if logging for the given level is enabled for the standard logger.
|
|
func IsLevelEnabled(level Level) bool {
|
|
return std.IsLevelEnabled(level)
|
|
}
|
|
|
|
// AddHook adds a hook to the standard logger hooks.
|
|
func AddHook(hook Hook) {
|
|
std.AddHook(hook)
|
|
}
|
|
|
|
// WithError creates an entry from the standard logger and adds an error to it,
|
|
// using the value defined in [ErrorKey] as key.
|
|
func WithError(err error) *Entry {
|
|
return std.WithError(err)
|
|
}
|
|
|
|
// WithContext creates an entry from the standard logger and adds a context to it.
|
|
func WithContext(ctx context.Context) *Entry {
|
|
return std.WithContext(ctx)
|
|
}
|
|
|
|
// WithField creates an entry from the standard logger and adds a single field.
|
|
// For multiple fields, prefer [WithFields] over chaining WithField calls.
|
|
func WithField(key string, value any) *Entry {
|
|
return std.WithField(key, value)
|
|
}
|
|
|
|
// WithFields creates an entry from the standard logger and adds the fields to it.
|
|
func WithFields(fields Fields) *Entry {
|
|
return std.WithFields(fields)
|
|
}
|
|
|
|
// WithTime creates an entry from the standard logger and overrides the time
|
|
// used for logs generated with it.
|
|
func WithTime(t time.Time) *Entry {
|
|
return std.WithTime(t)
|
|
}
|
|
|
|
// Trace logs a message at level [TraceLevel] on the standard logger.
|
|
func Trace(args ...any) {
|
|
std.Trace(args...)
|
|
}
|
|
|
|
// Debug logs a message at level [DebugLevel] on the standard logger.
|
|
func Debug(args ...any) {
|
|
std.Debug(args...)
|
|
}
|
|
|
|
// Print logs a message at level [InfoLevel] on the standard logger.
|
|
func Print(args ...any) {
|
|
std.Print(args...)
|
|
}
|
|
|
|
// Info logs a message at level [InfoLevel] on the standard logger.
|
|
func Info(args ...any) {
|
|
std.Info(args...)
|
|
}
|
|
|
|
// Warn logs a message at level [WarnLevel] on the standard logger.
|
|
func Warn(args ...any) {
|
|
std.Warn(args...)
|
|
}
|
|
|
|
// Warning logs a message at level [WarnLevel] on the standard logger.
|
|
func Warning(args ...any) {
|
|
std.Warning(args...)
|
|
}
|
|
|
|
// Error logs a message at level [ErrorLevel] on the standard logger.
|
|
func Error(args ...any) {
|
|
std.Error(args...)
|
|
}
|
|
|
|
// Panic logs a message at level [PanicLevel] on the standard logger.
|
|
func Panic(args ...any) {
|
|
std.Panic(args...)
|
|
}
|
|
|
|
// Fatal logs a message at level [FatalLevel] on the standard logger,
|
|
// then exits the process with status 1.
|
|
func Fatal(args ...any) {
|
|
std.Fatal(args...)
|
|
}
|
|
|
|
// TraceFn logs a message from a func at level [TraceLevel] on the standard logger.
|
|
func TraceFn(fn LogFunction) {
|
|
std.TraceFn(fn)
|
|
}
|
|
|
|
// DebugFn logs a message from a func at level [DebugLevel] on the standard logger.
|
|
func DebugFn(fn LogFunction) {
|
|
std.DebugFn(fn)
|
|
}
|
|
|
|
// PrintFn logs a message from a func at level [InfoLevel] on the standard logger.
|
|
func PrintFn(fn LogFunction) {
|
|
std.PrintFn(fn)
|
|
}
|
|
|
|
// InfoFn logs a message from a func at level [InfoLevel] on the standard logger.
|
|
func InfoFn(fn LogFunction) {
|
|
std.InfoFn(fn)
|
|
}
|
|
|
|
// WarnFn logs a message from a func at level [WarnLevel] on the standard logger.
|
|
func WarnFn(fn LogFunction) {
|
|
std.WarnFn(fn)
|
|
}
|
|
|
|
// WarningFn logs a message from a func at level [WarnLevel] on the standard logger.
|
|
func WarningFn(fn LogFunction) {
|
|
std.WarningFn(fn)
|
|
}
|
|
|
|
// ErrorFn logs a message from a func at level [ErrorLevel] on the standard logger.
|
|
func ErrorFn(fn LogFunction) {
|
|
std.ErrorFn(fn)
|
|
}
|
|
|
|
// PanicFn logs a message from a func at level [PanicLevel] on the standard logger.
|
|
func PanicFn(fn LogFunction) {
|
|
std.PanicFn(fn)
|
|
}
|
|
|
|
// FatalFn logs a message from a func at level [FatalLevel] on the standard logger,
|
|
// then exits the process with status 1.
|
|
func FatalFn(fn LogFunction) {
|
|
std.FatalFn(fn)
|
|
}
|
|
|
|
// Tracef logs a message at level [TraceLevel] on the standard logger.
|
|
func Tracef(format string, args ...any) {
|
|
std.Tracef(format, args...)
|
|
}
|
|
|
|
// Debugf logs a message at level [DebugLevel] on the standard logger.
|
|
func Debugf(format string, args ...any) {
|
|
std.Debugf(format, args...)
|
|
}
|
|
|
|
// Printf logs a message at level [InfoLevel] on the standard logger.
|
|
func Printf(format string, args ...any) {
|
|
std.Printf(format, args...)
|
|
}
|
|
|
|
// Infof logs a message at level [InfoLevel] on the standard logger.
|
|
func Infof(format string, args ...any) {
|
|
std.Infof(format, args...)
|
|
}
|
|
|
|
// Warnf logs a message at level [WarnLevel] on the standard logger.
|
|
func Warnf(format string, args ...any) {
|
|
std.Warnf(format, args...)
|
|
}
|
|
|
|
// Warningf logs a message at level [WarnLevel] on the standard logger.
|
|
func Warningf(format string, args ...any) {
|
|
std.Warningf(format, args...)
|
|
}
|
|
|
|
// Errorf logs a message at level [ErrorLevel] on the standard logger.
|
|
func Errorf(format string, args ...any) {
|
|
std.Errorf(format, args...)
|
|
}
|
|
|
|
// Panicf logs a message at level [PanicLevel] on the standard logger.
|
|
func Panicf(format string, args ...any) {
|
|
std.Panicf(format, args...)
|
|
}
|
|
|
|
// Fatalf logs a message at level [FatalLevel] on the standard logger,
|
|
// then exits the process with status 1.
|
|
func Fatalf(format string, args ...any) {
|
|
std.Fatalf(format, args...)
|
|
}
|
|
|
|
// Traceln logs a message at level [TraceLevel] on the standard logger.
|
|
func Traceln(args ...any) {
|
|
std.Traceln(args...)
|
|
}
|
|
|
|
// Debugln logs a message at level [DebugLevel] on the standard logger.
|
|
func Debugln(args ...any) {
|
|
std.Debugln(args...)
|
|
}
|
|
|
|
// Println logs a message at level [InfoLevel] on the standard logger.
|
|
func Println(args ...any) {
|
|
std.Println(args...)
|
|
}
|
|
|
|
// Infoln logs a message at level [InfoLevel] on the standard logger.
|
|
func Infoln(args ...any) {
|
|
std.Infoln(args...)
|
|
}
|
|
|
|
// Warnln logs a message at level [WarnLevel] on the standard logger.
|
|
func Warnln(args ...any) {
|
|
std.Warnln(args...)
|
|
}
|
|
|
|
// Warningln logs a message at level [WarnLevel] on the standard logger.
|
|
func Warningln(args ...any) {
|
|
std.Warningln(args...)
|
|
}
|
|
|
|
// Errorln logs a message at level [ErrorLevel] on the standard logger.
|
|
func Errorln(args ...any) {
|
|
std.Errorln(args...)
|
|
}
|
|
|
|
// Panicln logs a message at level [PanicLevel] on the standard logger.
|
|
func Panicln(args ...any) {
|
|
std.Panicln(args...)
|
|
}
|
|
|
|
// Fatalln logs a message at level [FatalLevel] on the standard logger,
|
|
// then exits the process with status 1.
|
|
func Fatalln(args ...any) {
|
|
std.Fatalln(args...)
|
|
}
|