From 075a84427f6332aab707d283ad770d69f8816032 Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 19 Oct 2020 23:40:00 +0200 Subject: Update vendor (#1265) --- vendor/github.com/mattermost/logr/levelstd.go | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 vendor/github.com/mattermost/logr/levelstd.go (limited to 'vendor/github.com/mattermost/logr/levelstd.go') diff --git a/vendor/github.com/mattermost/logr/levelstd.go b/vendor/github.com/mattermost/logr/levelstd.go new file mode 100644 index 00000000..f5e0fa46 --- /dev/null +++ b/vendor/github.com/mattermost/logr/levelstd.go @@ -0,0 +1,37 @@ +package logr + +// StdFilter allows targets to filter via classic log levels where any level +// beyond a certain verbosity/severity is enabled. +type StdFilter struct { + Lvl Level + Stacktrace Level +} + +// IsEnabled returns true if the specified Level is at or above this verbosity. Also +// determines if a stack trace is required. +func (lt StdFilter) IsEnabled(level Level) bool { + return level.ID <= lt.Lvl.ID +} + +// IsStacktraceEnabled returns true if the specified Level requires a stack trace. +func (lt StdFilter) IsStacktraceEnabled(level Level) bool { + return level.ID <= lt.Stacktrace.ID +} + +var ( + // Panic is the highest level of severity. Logs the message and then panics. + Panic = Level{ID: 0, Name: "panic"} + // Fatal designates a catastrophic error. Logs the message and then calls + // `logr.Exit(1)`. + Fatal = Level{ID: 1, Name: "fatal"} + // Error designates a serious but possibly recoverable error. + Error = Level{ID: 2, Name: "error"} + // Warn designates non-critical error. + Warn = Level{ID: 3, Name: "warn"} + // Info designates information regarding application events. + Info = Level{ID: 4, Name: "info"} + // Debug designates verbose information typically used for debugging. + Debug = Level{ID: 5, Name: "debug"} + // Trace designates the highest verbosity of log output. + Trace = Level{ID: 6, Name: "trace"} +) -- cgit v1.2.3