aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/sirupsen/logrus/formatter.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2019-08-02 15:07:53 +0200
committerOndrej Fabry <ofabry@cisco.com>2019-08-02 15:07:53 +0200
commitca6003af1a7e1adb7d45879c2d5038bc05c2bb1a (patch)
tree97a3620b0fc5c7a0ee032fe7d12d37b6303cfb01 /vendor/github.com/sirupsen/logrus/formatter.go
parent639870b5083a1e66f4584ec7a5f30492fcdb7168 (diff)
Migrate to modules, refactor Makefile and use Travis for CI
- migrate to Go modules and remove vendor - refactor Makefile - add version package and store version - split extras from the rest - use travis for CI Change-Id: I81b35220653b0f7c9a0fcdd4c527d691ec1e96c1 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'vendor/github.com/sirupsen/logrus/formatter.go')
-rw-r--r--vendor/github.com/sirupsen/logrus/formatter.go45
1 files changed, 0 insertions, 45 deletions
diff --git a/vendor/github.com/sirupsen/logrus/formatter.go b/vendor/github.com/sirupsen/logrus/formatter.go
deleted file mode 100644
index b5fbe93..0000000
--- a/vendor/github.com/sirupsen/logrus/formatter.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package logrus
-
-import "time"
-
-const DefaultTimestampFormat = time.RFC3339
-
-// The Formatter interface is used to implement a custom Formatter. It takes an
-// `Entry`. It exposes all the fields, including the default ones:
-//
-// * `entry.Data["msg"]`. The message passed from Info, Warn, Error ..
-// * `entry.Data["time"]`. The timestamp.
-// * `entry.Data["level"]. The level the entry was logged at.
-//
-// Any additional fields added with `WithField` or `WithFields` are also in
-// `entry.Data`. Format is expected to return an array of bytes which are then
-// logged to `logger.Out`.
-type Formatter interface {
- Format(*Entry) ([]byte, error)
-}
-
-// This is to not silently overwrite `time`, `msg` and `level` fields when
-// dumping it. If this code wasn't there doing:
-//
-// logrus.WithField("level", 1).Info("hello")
-//
-// Would just silently drop the user provided level. Instead with this code
-// it'll logged as:
-//
-// {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."}
-//
-// It's not exported because it's still using Data in an opinionated way. It's to
-// avoid code duplication between the two default formatters.
-func prefixFieldClashes(data Fields) {
- if t, ok := data["time"]; ok {
- data["fields.time"] = t
- }
-
- if m, ok := data["msg"]; ok {
- data["fields.msg"] = m
- }
-
- if l, ok := data["level"]; ok {
- data["fields.level"] = l
- }
-}