summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/matterbridge/logrus-prefixed-formatter
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-08-06 21:47:05 +0200
committerWim <wim@42.be>2018-08-06 21:47:05 +0200
commit51062863a5c34d81e296cf15c61140911037cf3b (patch)
tree9b5e044672486326c7a0ca8fb26430f37bf4d83c /vendor/github.com/matterbridge/logrus-prefixed-formatter
parent4fb4b7aa6c02a54db8ad8dd98e4d321396926c0d (diff)
downloadmatterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.gz
matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.bz2
matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.zip
Use mod vendor for vendored directory (backwards compatible)
Diffstat (limited to 'vendor/github.com/matterbridge/logrus-prefixed-formatter')
-rw-r--r--vendor/github.com/matterbridge/logrus-prefixed-formatter/.gitignore34
-rw-r--r--vendor/github.com/matterbridge/logrus-prefixed-formatter/.travis.yml14
-rw-r--r--vendor/github.com/matterbridge/logrus-prefixed-formatter/Makefile19
-rw-r--r--vendor/github.com/matterbridge/logrus-prefixed-formatter/README.md116
-rw-r--r--vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/basic.go59
-rw-r--r--vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/themes.go48
6 files changed, 183 insertions, 107 deletions
diff --git a/vendor/github.com/matterbridge/logrus-prefixed-formatter/.gitignore b/vendor/github.com/matterbridge/logrus-prefixed-formatter/.gitignore
new file mode 100644
index 00000000..450aeaa9
--- /dev/null
+++ b/vendor/github.com/matterbridge/logrus-prefixed-formatter/.gitignore
@@ -0,0 +1,34 @@
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
+*.test
+*.prof
+
+# IDEA files
+.idea
+*.iml
+
+# OS X
+.DS_Store
+
+# Unit testing
+*.coverprofile
diff --git a/vendor/github.com/matterbridge/logrus-prefixed-formatter/.travis.yml b/vendor/github.com/matterbridge/logrus-prefixed-formatter/.travis.yml
new file mode 100644
index 00000000..0c80b19a
--- /dev/null
+++ b/vendor/github.com/matterbridge/logrus-prefixed-formatter/.travis.yml
@@ -0,0 +1,14 @@
+language: go
+
+go:
+ - 1.5
+ - 1.6
+ - 1.7
+
+install:
+ - make deps
+
+script:
+ - make test
+
+sudo: false
diff --git a/vendor/github.com/matterbridge/logrus-prefixed-formatter/Makefile b/vendor/github.com/matterbridge/logrus-prefixed-formatter/Makefile
new file mode 100644
index 00000000..70c028cc
--- /dev/null
+++ b/vendor/github.com/matterbridge/logrus-prefixed-formatter/Makefile
@@ -0,0 +1,19 @@
+NAME=logrus-prefixed-formatter
+PACKAGES=$(shell go list ./...)
+
+deps:
+ @echo "--> Installing dependencies"
+ @go get -d -v -t ./...
+
+test-deps:
+ @which ginkgo 2>/dev/null ; if [ $$? -eq 1 ]; then \
+ go get -u -v github.com/onsi/ginkgo/ginkgo; \
+ fi
+
+test: test-deps
+ @echo "--> Running tests"
+ @ginkgo -r --randomizeAllSpecs --randomizeSuites --failOnPending --cover --trace --race
+
+format:
+ @echo "--> Running go fmt"
+ @go fmt $(PACKAGES)
diff --git a/vendor/github.com/matterbridge/logrus-prefixed-formatter/README.md b/vendor/github.com/matterbridge/logrus-prefixed-formatter/README.md
new file mode 100644
index 00000000..cf10f270
--- /dev/null
+++ b/vendor/github.com/matterbridge/logrus-prefixed-formatter/README.md
@@ -0,0 +1,116 @@
+# Logrus Prefixed Log Formatter
+[![Build Status](https://travis-ci.org/x-cray/logrus-prefixed-formatter.svg?branch=master)](https://travis-ci.org/x-cray/logrus-prefixed-formatter)
+
+[Logrus](https://github.com/sirupsen/logrus) formatter mainly based on original `logrus.TextFormatter` but with slightly
+modified colored output and support for log entry prefixes, e.g. message source followed by a colon. In addition, custom
+color themes are supported.
+
+![Formatter screenshot](http://cl.ly/image/1w0B3F233F3z/formatter-screenshot@2x.png)
+
+Just like with the original `logrus.TextFormatter` when a TTY is not attached, the output is compatible with the
+[logfmt](http://godoc.org/github.com/kr/logfmt) format:
+
+```text
+time="Oct 27 00:44:26" level=debug msg="Started observing beach" animal=walrus number=8
+time="Oct 27 00:44:26" level=info msg="A group of walrus emerges from the ocean" animal=walrus size=10
+time="Oct 27 00:44:26" level=warning msg="The group's number increased tremendously!" number=122 omg=true
+time="Oct 27 00:44:26" level=debug msg="Temperature changes" temperature=-4
+time="Oct 27 00:44:26" level=panic msg="It's over 9000!" animal=orca size=9009
+time="Oct 27 00:44:26" level=fatal msg="The ice breaks!" number=100 omg=true
+exit status 1
+```
+
+## Installation
+To install formatter, use `go get`:
+
+```sh
+$ go get github.com/x-cray/logrus-prefixed-formatter
+```
+
+## Usage
+Here is how it should be used:
+
+```go
+package main
+
+import (
+ "github.com/sirupsen/logrus"
+ prefixed "github.com/x-cray/logrus-prefixed-formatter"
+)
+
+var log = logrus.New()
+
+func init() {
+ log.Formatter = new(prefixed.TextFormatter)
+ log.Level = logrus.DebugLevel
+}
+
+func main() {
+ log.WithFields(logrus.Fields{
+ "prefix": "main",
+ "animal": "walrus",
+ "number": 8,
+ }).Debug("Started observing beach")
+
+ log.WithFields(logrus.Fields{
+ "prefix": "sensor",
+ "temperature": -4,
+ }).Info("Temperature changes")
+}
+```
+
+## API
+`prefixed.TextFormatter` exposes the following fields and methods.
+
+### Fields
+
+* `ForceColors bool` — set to true to bypass checking for a TTY before outputting colors.
+* `DisableColors bool` — force disabling colors. For a TTY colors are enabled by default.
+* `DisableUppercase bool` — set to true to turn off the conversion of the log level names to uppercase.
+* `ForceFormatting bool` — force formatted layout, even for non-TTY output.
+* `DisableTimestamp bool` — disable timestamp logging. Useful when output is redirected to logging system that already adds timestamps.
+* `FullTimestamp bool` — enable logging the full timestamp when a TTY is attached instead of just the time passed since beginning of execution.
+* `TimestampFormat string` — timestamp format to use for display when a full timestamp is printed.
+* `DisableSorting bool` — the fields are sorted by default for a consistent output. For applications that log extremely frequently and don't use the JSON formatter this may not be desired.
+* `QuoteEmptyFields bool` — wrap empty fields in quotes if true.
+* `QuoteCharacter string` — can be set to the override the default quoting character `"` with something else. For example: `'`, or `` ` ``.
+* `SpacePadding int` — pad msg field with spaces on the right for display. The value for this parameter will be the size of padding. Its default value is zero, which means no padding will be applied.
+
+### Methods
+
+#### `SetColorScheme(colorScheme *prefixed.ColorScheme)`
+
+Sets an alternative color scheme for colored output. `prefixed.ColorScheme` struct supports the following fields:
+* `InfoLevelStyle string` — info level style.
+* `WarnLevelStyle string` — warn level style.
+* `ErrorLevelStyle string` — error style.
+* `FatalLevelStyle string` — fatal level style.
+* `PanicLevelStyle string` — panic level style.
+* `DebugLevelStyle string` — debug level style.
+* `PrefixStyle string` — prefix style.
+* `TimestampStyle string` — timestamp style.
+
+Color styles should be specified using [mgutz/ansi](https://github.com/mgutz/ansi#style-format) style syntax. For example, here is the default theme:
+
+```go
+InfoLevelStyle: "green",
+WarnLevelStyle: "yellow",
+ErrorLevelStyle: "red",
+FatalLevelStyle: "red",
+PanicLevelStyle: "red",
+DebugLevelStyle: "blue",
+PrefixStyle: "cyan",
+TimestampStyle: "black+h"
+```
+
+It's not necessary to specify all colors when changing color scheme if you want to change just specific ones:
+
+```go
+formatter.SetColorScheme(&prefixed.ColorScheme{
+ PrefixStyle: "blue+b",
+ TimestampStyle: "white+h",
+})
+```
+
+# License
+MIT
diff --git a/vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/basic.go b/vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/basic.go
deleted file mode 100644
index 2a42cb43..00000000
--- a/vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/basic.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package main
-
-import (
- "github.com/sirupsen/logrus"
- prefixed "github.com/x-cray/logrus-prefixed-formatter"
-)
-
-var log = logrus.New()
-
-func init() {
- formatter := new(prefixed.TextFormatter)
- log.Formatter = formatter
- log.Level = logrus.DebugLevel
-}
-
-func main() {
- defer func() {
- err := recover()
- if err != nil {
- // Fatal message
- log.WithFields(logrus.Fields{
- "omg": true,
- "number": 100,
- }).Fatal("[main] The ice breaks!")
- }
- }()
-
- // You could either provide a map key called `prefix` to add prefix
- log.WithFields(logrus.Fields{
- "prefix": "main",
- "animal": "walrus",
- "number": 8,
- }).Debug("Started observing beach")
-
- // Or you can simply add prefix in square brackets within message itself
- log.WithFields(logrus.Fields{
- "animal": "walrus",
- "size": 10,
- }).Debug("[main] A group of walrus emerges from the ocean")
-
- // Warning message
- log.WithFields(logrus.Fields{
- "omg": true,
- "number": 122,
- }).Warn("[main] The group's number increased tremendously!")
-
- // Information message
- log.WithFields(logrus.Fields{
- "prefix": "sensor",
- "temperature": -4,
- }).Info("Temperature changes")
-
- // Panic message
- log.WithFields(logrus.Fields{
- "prefix": "sensor",
- "animal": "orca",
- "size": 9009,
- }).Panic("It's over 9000!")
-}
diff --git a/vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/themes.go b/vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/themes.go
deleted file mode 100644
index 6c911aea..00000000
--- a/vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/themes.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package main
-
-import (
- "github.com/sirupsen/logrus"
- prefixed "github.com/x-cray/logrus-prefixed-formatter"
-)
-
-var log = logrus.New()
-
-func init() {
- formatter := new(prefixed.TextFormatter)
- formatter.FullTimestamp = true
-
- // Set specific colors for prefix and timestamp
- formatter.SetColorScheme(&prefixed.ColorScheme{
- PrefixStyle: "blue+b",
- TimestampStyle: "white+h",
- })
-
- log.Formatter = formatter
- log.Level = logrus.DebugLevel
-}
-
-func main() {
- log.WithFields(logrus.Fields{
- "prefix": "main",
- "animal": "walrus",
- "number": 8,
- }).Debug("Started observing beach")
-
- // Or you can simply add prefix in square brackets within message itself
- log.WithFields(logrus.Fields{
- "animal": "walrus",
- "size": 10,
- }).Debug("[main] A group of walrus emerges from the ocean")
-
- // Warning message
- log.WithFields(logrus.Fields{
- "omg": true,
- "number": 122,
- }).Warn("[main] The group's number increased tremendously!")
-
- // Information message
- log.WithFields(logrus.Fields{
- "prefix": "sensor",
- "temperature": -4,
- }).Info("Temperature changes")
-}