summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/viper/logger.go
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2022-01-18 20:34:42 +0100
committerGitHub <noreply@github.com>2022-01-18 20:34:42 +0100
commit6aa05b39810bef5b5cf21cb2abd02012ce727574 (patch)
treeef76720d307a7edd2b71f1ae005df8b62594d7cd /vendor/github.com/spf13/viper/logger.go
parentaad60c882e16cd2c8769a49e6d9f87a040590d62 (diff)
downloadmatterbridge-msglm-6aa05b39810bef5b5cf21cb2abd02012ce727574.tar.gz
matterbridge-msglm-6aa05b39810bef5b5cf21cb2abd02012ce727574.tar.bz2
matterbridge-msglm-6aa05b39810bef5b5cf21cb2abd02012ce727574.zip
Bump github.com/spf13/viper from 1.9.0 to 1.10.1 (#1684)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.9.0 to 1.10.1. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](https://github.com/spf13/viper/compare/v1.9.0...v1.10.1) --- updated-dependencies: - dependency-name: github.com/spf13/viper dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/spf13/viper/logger.go')
-rw-r--r--vendor/github.com/spf13/viper/logger.go77
1 files changed, 77 insertions, 0 deletions
diff --git a/vendor/github.com/spf13/viper/logger.go b/vendor/github.com/spf13/viper/logger.go
new file mode 100644
index 00000000..0115067a
--- /dev/null
+++ b/vendor/github.com/spf13/viper/logger.go
@@ -0,0 +1,77 @@
+package viper
+
+import (
+ "fmt"
+
+ jww "github.com/spf13/jwalterweatherman"
+)
+
+// Logger is a unified interface for various logging use cases and practices, including:
+// - leveled logging
+// - structured logging
+type Logger interface {
+ // Trace logs a Trace event.
+ //
+ // Even more fine-grained information than Debug events.
+ // Loggers not supporting this level should fall back to Debug.
+ Trace(msg string, keyvals ...interface{})
+
+ // Debug logs a Debug event.
+ //
+ // A verbose series of information events.
+ // They are useful when debugging the system.
+ Debug(msg string, keyvals ...interface{})
+
+ // Info logs an Info event.
+ //
+ // General information about what's happening inside the system.
+ Info(msg string, keyvals ...interface{})
+
+ // Warn logs a Warn(ing) event.
+ //
+ // Non-critical events that should be looked at.
+ Warn(msg string, keyvals ...interface{})
+
+ // Error logs an Error event.
+ //
+ // Critical events that require immediate attention.
+ // Loggers commonly provide Fatal and Panic levels above Error level,
+ // but exiting and panicing is out of scope for a logging library.
+ Error(msg string, keyvals ...interface{})
+}
+
+type jwwLogger struct{}
+
+func (jwwLogger) Trace(msg string, keyvals ...interface{}) {
+ jww.TRACE.Printf(jwwLogMessage(msg, keyvals...))
+}
+
+func (jwwLogger) Debug(msg string, keyvals ...interface{}) {
+ jww.DEBUG.Printf(jwwLogMessage(msg, keyvals...))
+}
+
+func (jwwLogger) Info(msg string, keyvals ...interface{}) {
+ jww.INFO.Printf(jwwLogMessage(msg, keyvals...))
+}
+
+func (jwwLogger) Warn(msg string, keyvals ...interface{}) {
+ jww.WARN.Printf(jwwLogMessage(msg, keyvals...))
+}
+
+func (jwwLogger) Error(msg string, keyvals ...interface{}) {
+ jww.ERROR.Printf(jwwLogMessage(msg, keyvals...))
+}
+
+func jwwLogMessage(msg string, keyvals ...interface{}) string {
+ out := msg
+
+ if len(keyvals) > 0 && len(keyvals)%2 == 1 {
+ keyvals = append(keyvals, nil)
+ }
+
+ for i := 0; i <= len(keyvals)-2; i += 2 {
+ out = fmt.Sprintf("%s %v=%v", out, keyvals[i], keyvals[i+1])
+ }
+
+ return out
+}