summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/logr/levelstd.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-10-19 23:40:00 +0200
committerGitHub <noreply@github.com>2020-10-19 23:40:00 +0200
commit075a84427f6332aab707d283ad770d69f8816032 (patch)
tree0ff9f56a057919f3fe968e57f6f0b1c0d1f85078 /vendor/github.com/mattermost/logr/levelstd.go
parent950f2759bd2b20aa0bdedc3dc9a74d0dafb606d8 (diff)
downloadmatterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.tar.gz
matterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.tar.bz2
matterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.zip
Update vendor (#1265)
Diffstat (limited to 'vendor/github.com/mattermost/logr/levelstd.go')
-rw-r--r--vendor/github.com/mattermost/logr/levelstd.go37
1 files changed, 37 insertions, 0 deletions
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"}
+)