diff --git a/hack/vendor.sh b/hack/vendor.sh index ee2fcea023..7a99c38b09 100755 --- a/hack/vendor.sh +++ b/hack/vendor.sh @@ -43,7 +43,7 @@ clone() { } # the following lines are in sorted order, FYI -clone git github.com/Sirupsen/logrus v0.7.3 # logrus is a common dependency among multiple deps +clone git github.com/Sirupsen/logrus v0.8.2 # logrus is a common dependency among multiple deps clone git github.com/docker/libtrust 230dfd18c232 clone git github.com/go-check/check 64131543e7896d5bcc6bd5a76287eb75ea96c673 clone git github.com/gorilla/context 14f550f51a diff --git a/vendor/src/github.com/Sirupsen/logrus/CHANGELOG.md b/vendor/src/github.com/Sirupsen/logrus/CHANGELOG.md index eb72bff93b..49c5506a3e 100644 --- a/vendor/src/github.com/Sirupsen/logrus/CHANGELOG.md +++ b/vendor/src/github.com/Sirupsen/logrus/CHANGELOG.md @@ -1,3 +1,17 @@ +# 0.8.2 + +logrus: fix more Fatal family functions + +# 0.8.1 + +logrus: fix not exiting on `Fatalf` and `Fatalln` + +# 0.8.0 + +logrus: defaults to stderr instead of stdout +hooks/sentry: add special field for `*http.Request` +formatter/text: ignore Windows for colors + # 0.7.3 formatter/\*: allow configuration of timestamp layout diff --git a/vendor/src/github.com/Sirupsen/logrus/README.md b/vendor/src/github.com/Sirupsen/logrus/README.md index d55f909247..3578deaec0 100644 --- a/vendor/src/github.com/Sirupsen/logrus/README.md +++ b/vendor/src/github.com/Sirupsen/logrus/README.md @@ -32,7 +32,7 @@ ocean","size":10,"time":"2014-03-10 19:57:38.562264131 -0400 EDT"} "time":"2014-03-10 19:57:38.562543128 -0400 EDT"} ``` -With the default `log.Formatter = new(logrus.TextFormatter)` when a TTY is not +With the default `log.Formatter = new(&log.TextFormatter{})` when a TTY is not attached, the output is compatible with the [logfmt](http://godoc.org/github.com/kr/logfmt) format: @@ -211,6 +211,7 @@ func init() { | [Slackrus](https://github.com/johntdyer/slackrus) | Hook for Slack chat. | | [Journalhook](https://github.com/wercker/journalhook) | Hook for logging to `systemd-journald` | | [Graylog](https://github.com/gemnasium/logrus-hooks/tree/master/graylog) | Hook for logging to [Graylog](http://graylog2.org/) | +| [Raygun](https://github.com/squirkle/logrus-raygun-hook) | Hook for logging to [Raygun.io](http://raygun.io/) | #### Level logging @@ -269,7 +270,7 @@ init() { log.SetFormatter(logrus.JSONFormatter) } else { // The TextFormatter is default, you don't actually have to do this. - log.SetFormatter(logrus.TextFormatter) + log.SetFormatter(&log.TextFormatter{}) } } ``` diff --git a/vendor/src/github.com/Sirupsen/logrus/entry.go b/vendor/src/github.com/Sirupsen/logrus/entry.go index 17fe6f707b..699ea035cc 100644 --- a/vendor/src/github.com/Sirupsen/logrus/entry.go +++ b/vendor/src/github.com/Sirupsen/logrus/entry.go @@ -188,6 +188,7 @@ func (entry *Entry) Fatalf(format string, args ...interface{}) { if entry.Logger.Level >= FatalLevel { entry.Fatal(fmt.Sprintf(format, args...)) } + os.Exit(1) } func (entry *Entry) Panicf(format string, args ...interface{}) { @@ -234,6 +235,7 @@ func (entry *Entry) Fatalln(args ...interface{}) { if entry.Logger.Level >= FatalLevel { entry.Fatal(entry.sprintlnn(args...)) } + os.Exit(1) } func (entry *Entry) Panicln(args ...interface{}) { diff --git a/vendor/src/github.com/Sirupsen/logrus/hooks/sentry/README.md b/vendor/src/github.com/Sirupsen/logrus/hooks/sentry/README.md index 19e58bb457..4e1c1476f5 100644 --- a/vendor/src/github.com/Sirupsen/logrus/hooks/sentry/README.md +++ b/vendor/src/github.com/Sirupsen/logrus/hooks/sentry/README.md @@ -34,12 +34,13 @@ func main() { ## Special fields Some logrus fields have a special meaning in this hook, -these are server_name and logger. +these are `server_name`, `logger` and `http_request`. When logs are sent to sentry these fields are treated differently. -- server_name (also known as hostname) is the name of the server which +- `server_name` (also known as hostname) is the name of the server which is logging the event (hostname.example.com) -- logger is the part of the application which is logging the event. +- `logger` is the part of the application which is logging the event. In go this usually means setting it to the name of the package. +- `http_request` is the in-coming request(*http.Request). The detailed request data are sent to Sentry. ## Timeout diff --git a/vendor/src/github.com/Sirupsen/logrus/hooks/sentry/sentry.go b/vendor/src/github.com/Sirupsen/logrus/hooks/sentry/sentry.go index 379f281c53..e7e45b21b2 100644 --- a/vendor/src/github.com/Sirupsen/logrus/hooks/sentry/sentry.go +++ b/vendor/src/github.com/Sirupsen/logrus/hooks/sentry/sentry.go @@ -3,6 +3,7 @@ package logrus_sentry import ( "fmt" "time" + "net/http" "github.com/Sirupsen/logrus" "github.com/getsentry/raven-go" @@ -36,6 +37,22 @@ func getAndDel(d logrus.Fields, key string) (string, bool) { return val, true } +func getAndDelRequest(d logrus.Fields, key string) (*http.Request, bool) { + var ( + ok bool + v interface{} + req *http.Request + ) + if v, ok = d[key]; !ok { + return nil, false + } + if req, ok = v.(*http.Request); !ok || req == nil { + return nil, false + } + delete(d, key) + return req, true +} + // SentryHook delivers logs to a sentry server. type SentryHook struct { // Timeout sets the time to wait for a delivery error from the sentry server. @@ -61,7 +78,7 @@ func NewSentryHook(DSN string, levels []logrus.Level) (*SentryHook, error) { // Called when an event should be sent to sentry // Special fields that sentry uses to give more information to the server // are extracted from entry.Data (if they are found) -// These fields are: logger and server_name +// These fields are: logger, server_name and http_request func (hook *SentryHook) Fire(entry *logrus.Entry) error { packet := &raven.Packet{ Message: entry.Message, @@ -78,6 +95,9 @@ func (hook *SentryHook) Fire(entry *logrus.Entry) error { if serverName, ok := getAndDel(d, "server_name"); ok { packet.ServerName = serverName } + if req, ok := getAndDelRequest(d, "http_request"); ok { + packet.Interfaces = append(packet.Interfaces, raven.NewHttp(req)) + } packet.Extra = map[string]interface{}(d) _, errCh := hook.client.Capture(packet, nil) diff --git a/vendor/src/github.com/Sirupsen/logrus/hooks/sentry/sentry_test.go b/vendor/src/github.com/Sirupsen/logrus/hooks/sentry/sentry_test.go index 45f18d1704..5f3696b291 100644 --- a/vendor/src/github.com/Sirupsen/logrus/hooks/sentry/sentry_test.go +++ b/vendor/src/github.com/Sirupsen/logrus/hooks/sentry/sentry_test.go @@ -61,9 +61,12 @@ func TestSpecialFields(t *testing.T) { t.Fatal(err.Error()) } logger.Hooks.Add(hook) + + req, _ := http.NewRequest("GET", "url", nil) logger.WithFields(logrus.Fields{ - "server_name": server_name, - "logger": logger_name, + "server_name": server_name, + "logger": logger_name, + "http_request": req, }).Error(message) packet := <-pch diff --git a/vendor/src/github.com/Sirupsen/logrus/json_formatter.go b/vendor/src/github.com/Sirupsen/logrus/json_formatter.go index dcc4f1d9fd..2ad6dc5cf4 100644 --- a/vendor/src/github.com/Sirupsen/logrus/json_formatter.go +++ b/vendor/src/github.com/Sirupsen/logrus/json_formatter.go @@ -24,11 +24,12 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { } prefixFieldClashes(data) - if f.TimestampFormat == "" { - f.TimestampFormat = DefaultTimestampFormat + timestampFormat := f.TimestampFormat + if timestampFormat == "" { + timestampFormat = DefaultTimestampFormat } - data["time"] = entry.Time.Format(f.TimestampFormat) + data["time"] = entry.Time.Format(timestampFormat) data["msg"] = entry.Message data["level"] = entry.Level.String() diff --git a/vendor/src/github.com/Sirupsen/logrus/logger.go b/vendor/src/github.com/Sirupsen/logrus/logger.go index da928a3750..292b0b2c07 100644 --- a/vendor/src/github.com/Sirupsen/logrus/logger.go +++ b/vendor/src/github.com/Sirupsen/logrus/logger.go @@ -44,7 +44,7 @@ type Logger struct { // It's recommended to make this a global instance called `log`. func New() *Logger { return &Logger{ - Out: os.Stdout, + Out: os.Stderr, Formatter: new(TextFormatter), Hooks: make(levelHooks), Level: InfoLevel, @@ -102,6 +102,7 @@ func (logger *Logger) Fatalf(format string, args ...interface{}) { if logger.Level >= FatalLevel { NewEntry(logger).Fatalf(format, args...) } + os.Exit(1) } func (logger *Logger) Panicf(format string, args ...interface{}) { @@ -148,6 +149,7 @@ func (logger *Logger) Fatal(args ...interface{}) { if logger.Level >= FatalLevel { NewEntry(logger).Fatal(args...) } + os.Exit(1) } func (logger *Logger) Panic(args ...interface{}) { @@ -194,6 +196,7 @@ func (logger *Logger) Fatalln(args ...interface{}) { if logger.Level >= FatalLevel { NewEntry(logger).Fatalln(args...) } + os.Exit(1) } func (logger *Logger) Panicln(args ...interface{}) { diff --git a/vendor/src/github.com/Sirupsen/logrus/logrus_test.go b/vendor/src/github.com/Sirupsen/logrus/logrus_test.go index d85dba4dcb..efaacea236 100644 --- a/vendor/src/github.com/Sirupsen/logrus/logrus_test.go +++ b/vendor/src/github.com/Sirupsen/logrus/logrus_test.go @@ -191,7 +191,7 @@ func TestUserSuppliedLevelFieldHasPrefix(t *testing.T) { log.WithField("level", 1).Info("test") }, func(fields Fields) { assert.Equal(t, fields["level"], "info") - assert.Equal(t, fields["fields.level"], 1) + assert.Equal(t, fields["fields.level"], 1.0) // JSON has floats only }) } diff --git a/vendor/src/github.com/Sirupsen/logrus/text_formatter.go b/vendor/src/github.com/Sirupsen/logrus/text_formatter.go index 612417ff9c..4ed90e1e52 100644 --- a/vendor/src/github.com/Sirupsen/logrus/text_formatter.go +++ b/vendor/src/github.com/Sirupsen/logrus/text_formatter.go @@ -3,6 +3,7 @@ package logrus import ( "bytes" "fmt" + "runtime" "sort" "strings" "time" @@ -69,7 +70,8 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { prefixFieldClashes(entry.Data) - isColored := (f.ForceColors || isTerminal) && !f.DisableColors + isColorTerminal := isTerminal && (runtime.GOOS != "windows") + isColored := (f.ForceColors || isColorTerminal) && !f.DisableColors if f.TimestampFormat == "" { f.TimestampFormat = DefaultTimestampFormat