import sirupsen with lowercase 32/8332/1
authorLukas Macko <lmacko@cisco.com>
Thu, 7 Sep 2017 10:45:41 +0000 (12:45 +0200)
committerLukas Macko <lmacko@cisco.com>
Thu, 7 Sep 2017 10:45:41 +0000 (12:45 +0200)
Change-Id: I555587fc9ecc074ea1a42f0dc77c11716a1b06cb
Signed-off-by: Lukas Macko <lmacko@cisco.com>
47 files changed:
core/core.go
core/msg_codec.go
core/notification_handler.go
core/request_handler.go
examples/cmd/perf-bench/perf-bench.go
glide.lock
glide.yaml
vendor/github.com/Sirupsen/logrus/.travis.yml [deleted file]
vendor/github.com/Sirupsen/logrus/hooks/test/test.go [deleted file]
vendor/github.com/Sirupsen/logrus/terminal_windows.go [deleted file]
vendor/github.com/sirupsen/logrus/.gitignore [moved from vendor/github.com/Sirupsen/logrus/.gitignore with 100% similarity]
vendor/github.com/sirupsen/logrus/.travis.yml [new file with mode: 0644]
vendor/github.com/sirupsen/logrus/CHANGELOG.md [moved from vendor/github.com/Sirupsen/logrus/CHANGELOG.md with 94% similarity]
vendor/github.com/sirupsen/logrus/LICENSE [moved from vendor/github.com/Sirupsen/logrus/LICENSE with 100% similarity]
vendor/github.com/sirupsen/logrus/README.md [moved from vendor/github.com/Sirupsen/logrus/README.md with 86% similarity]
vendor/github.com/sirupsen/logrus/alt_exit.go [moved from vendor/github.com/Sirupsen/logrus/alt_exit.go with 96% similarity]
vendor/github.com/sirupsen/logrus/alt_exit_test.go [moved from vendor/github.com/Sirupsen/logrus/alt_exit_test.go with 97% similarity]
vendor/github.com/sirupsen/logrus/doc.go [moved from vendor/github.com/Sirupsen/logrus/doc.go with 83% similarity]
vendor/github.com/sirupsen/logrus/entry.go [moved from vendor/github.com/Sirupsen/logrus/entry.go with 89% similarity]
vendor/github.com/sirupsen/logrus/entry_test.go [moved from vendor/github.com/Sirupsen/logrus/entry_test.go with 100% similarity]
vendor/github.com/sirupsen/logrus/examples/basic/basic.go [moved from vendor/github.com/Sirupsen/logrus/examples/basic/basic.go with 97% similarity]
vendor/github.com/sirupsen/logrus/examples/hook/hook.go [moved from vendor/github.com/Sirupsen/logrus/examples/hook/hook.go with 95% similarity]
vendor/github.com/sirupsen/logrus/exported.go [moved from vendor/github.com/Sirupsen/logrus/exported.go with 99% similarity]
vendor/github.com/sirupsen/logrus/formatter.go [moved from vendor/github.com/Sirupsen/logrus/formatter.go with 100% similarity]
vendor/github.com/sirupsen/logrus/formatter_bench_test.go [moved from vendor/github.com/Sirupsen/logrus/formatter_bench_test.go with 100% similarity]
vendor/github.com/sirupsen/logrus/hook_test.go [moved from vendor/github.com/Sirupsen/logrus/hook_test.go with 100% similarity]
vendor/github.com/sirupsen/logrus/hooks.go [moved from vendor/github.com/Sirupsen/logrus/hooks.go with 100% similarity]
vendor/github.com/sirupsen/logrus/hooks/syslog/README.md [moved from vendor/github.com/Sirupsen/logrus/hooks/syslog/README.md with 80% similarity]
vendor/github.com/sirupsen/logrus/hooks/syslog/syslog.go [moved from vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog.go with 97% similarity]
vendor/github.com/sirupsen/logrus/hooks/syslog/syslog_test.go [moved from vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go with 94% similarity]
vendor/github.com/sirupsen/logrus/hooks/test/test.go [new file with mode: 0644]
vendor/github.com/sirupsen/logrus/hooks/test/test_test.go [moved from vendor/github.com/Sirupsen/logrus/hooks/test/test_test.go with 96% similarity]
vendor/github.com/sirupsen/logrus/json_formatter.go [moved from vendor/github.com/Sirupsen/logrus/json_formatter.go with 94% similarity]
vendor/github.com/sirupsen/logrus/json_formatter_test.go [moved from vendor/github.com/Sirupsen/logrus/json_formatter_test.go with 100% similarity]
vendor/github.com/sirupsen/logrus/logger.go [moved from vendor/github.com/Sirupsen/logrus/logger.go with 88% similarity]
vendor/github.com/sirupsen/logrus/logger_bench_test.go [moved from vendor/github.com/Sirupsen/logrus/logger_bench_test.go with 100% similarity]
vendor/github.com/sirupsen/logrus/logrus.go [moved from vendor/github.com/Sirupsen/logrus/logrus.go with 99% similarity]
vendor/github.com/sirupsen/logrus/logrus_test.go [moved from vendor/github.com/Sirupsen/logrus/logrus_test.go with 100% similarity]
vendor/github.com/sirupsen/logrus/terminal_appengine.go [moved from vendor/github.com/Sirupsen/logrus/terminal_appengine.go with 100% similarity]
vendor/github.com/sirupsen/logrus/terminal_bsd.go [moved from vendor/github.com/Sirupsen/logrus/terminal_bsd.go with 100% similarity]
vendor/github.com/sirupsen/logrus/terminal_linux.go [moved from vendor/github.com/Sirupsen/logrus/terminal_linux.go with 100% similarity]
vendor/github.com/sirupsen/logrus/terminal_notwindows.go [moved from vendor/github.com/Sirupsen/logrus/terminal_notwindows.go with 100% similarity]
vendor/github.com/sirupsen/logrus/terminal_solaris.go [moved from vendor/github.com/Sirupsen/logrus/terminal_solaris.go with 100% similarity]
vendor/github.com/sirupsen/logrus/terminal_windows.go [new file with mode: 0644]
vendor/github.com/sirupsen/logrus/text_formatter.go [moved from vendor/github.com/Sirupsen/logrus/text_formatter.go with 100% similarity]
vendor/github.com/sirupsen/logrus/text_formatter_test.go [moved from vendor/github.com/Sirupsen/logrus/text_formatter_test.go with 100% similarity]
vendor/github.com/sirupsen/logrus/writer.go [moved from vendor/github.com/Sirupsen/logrus/writer.go with 100% similarity]

index 3eea332..94218d8 100644 (file)
@@ -23,7 +23,7 @@ import (
        "sync/atomic"
        "time"
 
-       logger "github.com/Sirupsen/logrus"
+       logger "github.com/sirupsen/logrus"
 
        "git.fd.io/govpp.git/adapter"
        "git.fd.io/govpp.git/api"
index 5614a7e..999b502 100644 (file)
@@ -20,8 +20,8 @@ import (
        "fmt"
        "reflect"
 
-       logger "github.com/Sirupsen/logrus"
        "github.com/lunixbochs/struc"
+       logger "github.com/sirupsen/logrus"
 
        "git.fd.io/govpp.git/api"
 )
index 5cd132c..89c16a4 100644 (file)
@@ -18,7 +18,7 @@ import (
        "fmt"
        "reflect"
 
-       logger "github.com/Sirupsen/logrus"
+       logger "github.com/sirupsen/logrus"
 
        "git.fd.io/govpp.git/api"
 )
index e0235b9..c1683d3 100644 (file)
@@ -19,7 +19,7 @@ import (
        "fmt"
        "sync/atomic"
 
-       logger "github.com/Sirupsen/logrus"
+       logger "github.com/sirupsen/logrus"
 
        "git.fd.io/govpp.git/api"
        "git.fd.io/govpp.git/core/bin_api/vpe"
index e414b20..f76f671 100644 (file)
@@ -24,8 +24,8 @@ import (
        "sync"
        "time"
 
-       "github.com/Sirupsen/logrus"
        "github.com/pkg/profile"
+       "github.com/sirupsen/logrus"
 
        "git.fd.io/govpp.git"
        "git.fd.io/govpp.git/api"
index 249e414..eeab1d6 100644 (file)
@@ -1,5 +1,5 @@
-hash: d2f925bd432f2ecb4c13a9fafd03b3feb046c661190c978cb5b95507ed1ef80b
-updated: 2017-09-07T09:58:11.434867834+02:00
+hash: 0aac6d01a9a659af0e0c66daa2a78ccee2d6cd596bb9a26b3baa3dc17089299b
+updated: 2017-09-07T12:41:21.189615278+02:00
 imports:
 - name: github.com/bennyscetbun/jsongo
   version: 5240b3f82c6665fe3ccd96bdf5e6f38fe1e1399d
@@ -9,8 +9,8 @@ imports:
   version: ef56447db6a068ad9e52bc54a1aff5fb9e1ed2dd
 - name: github.com/pkg/profile
   version: 5b67d428864e92711fcbd2f8629456121a56d91f
-- name: github.com/Sirupsen/logrus
-  version: ba1b36c82c5e05c4f912a88eab0dcd91a171688f
+- name: github.com/sirupsen/logrus
+  version: 202f25545ea4cf9b191ff7f846df5d87c9382c2b
 - name: golang.org/x/sys
   version: e48874b42435b4347fc52bdee0424a52abc974d7
   subpackages:
index 9f31bc1..5734a80 100644 (file)
@@ -1,7 +1,7 @@
 package: git.fd.io/govpp.git
 import:
-- package: github.com/Sirupsen/logrus
-  version: v0.11.5
+- package: github.com/sirupsen/logrus
+  version: v1.0.0
 - package: github.com/bennyscetbun/jsongo
   version: 5240b3f82c6665fe3ccd96bdf5e6f38fe1e1399d
 - package: github.com/lunixbochs/struc
diff --git a/vendor/github.com/Sirupsen/logrus/.travis.yml b/vendor/github.com/Sirupsen/logrus/.travis.yml
deleted file mode 100644 (file)
index 804c569..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-language: go
-go:
-  - 1.6
-  - 1.7
-  - tip
-install:
-  - go get -t ./...
-script: GOMAXPROCS=4 GORACE="halt_on_error=1" go test -race -v ./...
diff --git a/vendor/github.com/Sirupsen/logrus/hooks/test/test.go b/vendor/github.com/Sirupsen/logrus/hooks/test/test.go
deleted file mode 100644 (file)
index 0688125..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-package test
-
-import (
-       "io/ioutil"
-
-       "github.com/Sirupsen/logrus"
-)
-
-// test.Hook is a hook designed for dealing with logs in test scenarios.
-type Hook struct {
-       Entries []*logrus.Entry
-}
-
-// Installs a test hook for the global logger.
-func NewGlobal() *Hook {
-
-       hook := new(Hook)
-       logrus.AddHook(hook)
-
-       return hook
-
-}
-
-// Installs a test hook for a given local logger.
-func NewLocal(logger *logrus.Logger) *Hook {
-
-       hook := new(Hook)
-       logger.Hooks.Add(hook)
-
-       return hook
-
-}
-
-// Creates a discarding logger and installs the test hook.
-func NewNullLogger() (*logrus.Logger, *Hook) {
-
-       logger := logrus.New()
-       logger.Out = ioutil.Discard
-
-       return logger, NewLocal(logger)
-
-}
-
-func (t *Hook) Fire(e *logrus.Entry) error {
-       t.Entries = append(t.Entries, e)
-       return nil
-}
-
-func (t *Hook) Levels() []logrus.Level {
-       return logrus.AllLevels
-}
-
-// LastEntry returns the last entry that was logged or nil.
-func (t *Hook) LastEntry() (l *logrus.Entry) {
-
-       if i := len(t.Entries) - 1; i < 0 {
-               return nil
-       } else {
-               return t.Entries[i]
-       }
-
-}
-
-// Reset removes all Entries from this test hook.
-func (t *Hook) Reset() {
-       t.Entries = make([]*logrus.Entry, 0)
-}
diff --git a/vendor/github.com/Sirupsen/logrus/terminal_windows.go b/vendor/github.com/Sirupsen/logrus/terminal_windows.go
deleted file mode 100644 (file)
index 05d2f91..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// Based on ssh/terminal:
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows,!appengine
-
-package logrus
-
-import (
-       "io"
-       "os"
-       "syscall"
-       "unsafe"
-)
-
-var kernel32 = syscall.NewLazyDLL("kernel32.dll")
-
-var (
-       procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
-)
-
-// IsTerminal returns true if stderr's file descriptor is a terminal.
-func IsTerminal(f io.Writer) bool {
-       switch v := f.(type) {
-       case *os.File:
-               var st uint32
-               r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(v.Fd()), uintptr(unsafe.Pointer(&st)), 0)
-               return r != 0 && e == 0
-       default:
-               return false
-       }
-}
diff --git a/vendor/github.com/sirupsen/logrus/.travis.yml b/vendor/github.com/sirupsen/logrus/.travis.yml
new file mode 100644 (file)
index 0000000..924f3c4
--- /dev/null
@@ -0,0 +1,13 @@
+language: go
+go:
+  - 1.6.x
+  - 1.7.x
+  - 1.8.x
+  - tip
+env:
+  - GOMAXPROCS=4 GORACE=halt_on_error=1
+install:
+  - go get github.com/stretchr/testify/assert
+script:
+  - go test -race -v .
+  - cd hooks/null && go test -race -v .
@@ -1,3 +1,9 @@
+# 1.0.0
+
+* Officially changed name to lower-case
+* bug: colors on Windows 10 (#541)
+* bug: fix race in accessing level (#512)
+
 # 0.11.5
 
 * feature: add writer and writerlevel to entry (#372)
similarity index 86%
rename from vendor/github.com/Sirupsen/logrus/README.md
rename to vendor/github.com/sirupsen/logrus/README.md
index 640cf61..cbe8b69 100644 (file)
@@ -1,10 +1,4 @@
-# Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:"/>&nbsp;[![Build Status](https://travis-ci.org/Sirupsen/logrus.svg?branch=master)](https://travis-ci.org/Sirupsen/logrus)&nbsp;[![GoDoc](https://godoc.org/github.com/Sirupsen/logrus?status.svg)](https://godoc.org/github.com/Sirupsen/logrus)
-
-**Seeing weird case-sensitive problems?** See [this
-issue](https://github.com/sirupsen/logrus/issues/451#issuecomment-264332021).
-This change has been reverted. I apologize for causing this. I greatly
-underestimated the impact this would have. Logrus strives for stability and
-backwards compatibility and failed to provide that.
+# Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:"/>&nbsp;[![Build Status](https://travis-ci.org/sirupsen/logrus.svg?branch=master)](https://travis-ci.org/sirupsen/logrus)&nbsp;[![GoDoc](https://godoc.org/github.com/sirupsen/logrus?status.svg)](https://godoc.org/github.com/sirupsen/logrus)
 
 Logrus is a structured logger for Go (golang), completely API compatible with
 the standard library logger. [Godoc][godoc]. **Please note the Logrus API is not
@@ -13,6 +7,17 @@ many large deployments. The core API is unlikely to change much but please
 version control your Logrus to make sure you aren't fetching latest `master` on
 every build.**
 
+**Seeing weird case-sensitive problems?** Unfortunately, the author failed to
+realize the consequences of renaming to lower-case. Due to the Go package
+environment, this caused issues. Regretfully, there's no turning back now.
+Everything using `logrus` will need to use the lower-case:
+`github.com/sirupsen/logrus`. Any package that isn't, should be changed.
+
+I am terribly sorry for this inconvenience. Logrus strives hard for backwards
+compatibility, and the author failed to realize the cascading consequences of
+such a name-change. To fix Glide, see [these
+comments](https://github.com/sirupsen/logrus/issues/553#issuecomment-306591437).
+
 Nicely color-coded in development (when a TTY is attached, otherwise just
 plain text):
 
@@ -52,6 +57,12 @@ time="2015-03-26T01:27:38-04:00" level=fatal msg="The ice breaks!" err=&{0x20822
 exit status 1
 ```
 
+#### Case-sensitivity
+
+The organization's name was changed to lower-case--and this will not be changed
+back. If you are getting import conflicts due to case sensitivity, please use
+the lower-case import: `github.com/sirupsen/logrus`.
+
 #### Example
 
 The simplest way to use Logrus is simply the package-level exported logger:
@@ -60,7 +71,7 @@ The simplest way to use Logrus is simply the package-level exported logger:
 package main
 
 import (
-  log "github.com/Sirupsen/logrus"
+  log "github.com/sirupsen/logrus"
 )
 
 func main() {
@@ -71,7 +82,7 @@ func main() {
 ```
 
 Note that it's completely api-compatible with the stdlib logger, so you can
-replace your `log` imports everywhere with `log "github.com/Sirupsen/logrus"`
+replace your `log` imports everywhere with `log "github.com/sirupsen/logrus"`
 and you'll now have the flexibility of Logrus. You can customize it all you
 want:
 
@@ -80,7 +91,7 @@ package main
 
 import (
   "os"
-  log "github.com/Sirupsen/logrus"
+  log "github.com/sirupsen/logrus"
 )
 
 func init() {
@@ -130,7 +141,8 @@ application, you can also create an instance of the `logrus` Logger:
 package main
 
 import (
-  "github.com/Sirupsen/logrus"
+  "os"
+  "github.com/sirupsen/logrus"
 )
 
 // Create a new instance of the logger. You can have any number of instances.
@@ -158,7 +170,7 @@ func main() {
 
 #### Fields
 
-Logrus encourages careful, structured logging though logging fields instead of
+Logrus encourages careful, structured logging through logging fields instead of
 long, unparseable error messages. For example, instead of: `log.Fatalf("Failed
 to send event %s to topic %s with key %d")`, you should log the much more
 discoverable:
@@ -189,7 +201,7 @@ application or parts of one. For example, you may want to always log the
 every line, you can create a `logrus.Entry` to pass around instead:
 
 ```go
-requestLogger := log.WithFields(log.Fields{"request_id": request_id, user_ip: user_ip})
+requestLogger := log.WithFields(log.Fields{"request_id": request_id, "user_ip": user_ip})
 requestLogger.Info("something happened on that request") # will log request_id and user_ip
 requestLogger.Warn("something not great happened")
 ```
@@ -205,9 +217,9 @@ Logrus comes with [built-in hooks](hooks/). Add those, or your custom hook, in
 
 ```go
 import (
-  log "github.com/Sirupsen/logrus"
+  log "github.com/sirupsen/logrus"
   "gopkg.in/gemnasium/logrus-airbrake-hook.v2" // the package is named "aibrake"
-  logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog"
+  logrus_syslog "github.com/sirupsen/logrus/hooks/syslog"
   "log/syslog"
 )
 
@@ -235,14 +247,16 @@ Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/v
 | [Amqp-Hook](https://github.com/vladoatanasov/logrus_amqp) | Hook for logging to Amqp broker (Like RabbitMQ) |
 | [Bugsnag](https://github.com/Shopify/logrus-bugsnag/blob/master/bugsnag.go) | Send errors to the Bugsnag exception tracking service. |
 | [DeferPanic](https://github.com/deferpanic/dp-logrus) | Hook for logging to DeferPanic |
+| [Discordrus](https://github.com/kz/discordrus) | Hook for logging to [Discord](https://discordapp.com/) |
 | [ElasticSearch](https://github.com/sohlich/elogrus) | Hook for logging to ElasticSearch|
+| [Firehose](https://github.com/beaubrewer/logrus_firehose) | Hook for logging to [Amazon Firehose](https://aws.amazon.com/kinesis/firehose/)
 | [Fluentd](https://github.com/evalphobia/logrus_fluent) | Hook for logging to fluentd |
 | [Go-Slack](https://github.com/multiplay/go-slack) | Hook for logging to [Slack](https://slack.com) |
 | [Graylog](https://github.com/gemnasium/logrus-graylog-hook) | Hook for logging to [Graylog](http://graylog2.org/) |
 | [Hiprus](https://github.com/nubo/hiprus) | Send errors to a channel in hipchat. |
 | [Honeybadger](https://github.com/agonzalezro/logrus_honeybadger) | Hook for sending exceptions to Honeybadger |
 | [InfluxDB](https://github.com/Abramovic/logrus_influxdb) | Hook for logging to influxdb |
-| [Influxus] (http://github.com/vlad-doru/influxus) | Hook for concurrently logging to [InfluxDB] (http://influxdata.com/) |
+| [Influxus](http://github.com/vlad-doru/influxus) | Hook for concurrently logging to [InfluxDB](http://influxdata.com/) |
 | [Journalhook](https://github.com/wercker/journalhook) | Hook for logging to `systemd-journald` |
 | [KafkaLogrus](https://github.com/goibibo/KafkaLogrus) | Hook for logging to kafka |
 | [LFShook](https://github.com/rifflock/lfshook) | Hook for logging to the local filesystem |
@@ -267,9 +281,11 @@ Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/v
 | [Stackdriver](https://github.com/knq/sdhook) | Hook for logging to [Google Stackdriver](https://cloud.google.com/logging/) |
 | [Sumorus](https://github.com/doublefree/sumorus) | Hook for logging to [SumoLogic](https://www.sumologic.com/)|
 | [Syslog](https://github.com/Sirupsen/logrus/blob/master/hooks/syslog/syslog.go) | Send errors to remote syslog server. Uses standard library `log/syslog` behind the scenes. |
+| [Syslog TLS](https://github.com/shinji62/logrus-syslog-ng) | Send errors to remote syslog server with TLS support. |
 | [TraceView](https://github.com/evalphobia/logrus_appneta) | Hook for logging to [AppNeta TraceView](https://www.appneta.com/products/traceview/) |
 | [Typetalk](https://github.com/dragon3/logrus-typetalk-hook) | Hook for logging to [Typetalk](https://www.typetalk.in/) |
 | [logz.io](https://github.com/ripcurld00d/logrus-logzio-hook) | Hook for logging to [logz.io](https://logz.io), a Log as a Service using Logstash |
+| [SQS-Hook](https://github.com/tsarpaul/logrus_sqs) | Hook for logging to [Amazon Simple Queue Service (SQS)](https://aws.amazon.com/sqs/) |
 
 #### Level logging
 
@@ -318,7 +334,7 @@ could do:
 
 ```go
 import (
-  log "github.com/Sirupsen/logrus"
+  log "github.com/sirupsen/logrus"
 )
 
 init() {
@@ -421,7 +437,7 @@ entries. It should not be a feature of the application-level logger.
 | Tool | Description |
 | ---- | ----------- |
 |[Logrus Mate](https://github.com/gogap/logrus_mate)|Logrus mate is a tool for Logrus to manage loggers, you can initial logger's level, hook and formatter by config file, the logger will generated with different config at different environment.|
-|[Logrus Viper Helper](https://github.com/heirko/go-contrib/tree/master/logrusHelper)|An Helper arround Logrus to wrap with spf13/Viper to load configuration with fangs! And to simplify Logrus configuration use some behavior of [Logrus Mate](https://github.com/gogap/logrus_mate). [sample](https://github.com/heirko/iris-contrib/blob/master/middleware/logrus-logger/example) |
+|[Logrus Viper Helper](https://github.com/heirko/go-contrib/tree/master/logrusHelper)|An Helper around Logrus to wrap with spf13/Viper to load configuration with fangs! And to simplify Logrus configuration use some behavior of [Logrus Mate](https://github.com/gogap/logrus_mate). [sample](https://github.com/heirko/iris-contrib/blob/master/middleware/logrus-logger/example) |
 
 #### Testing
 
@@ -431,15 +447,24 @@ Logrus has a built in facility for asserting the presence of log messages. This
 * a test logger (`test.NewNullLogger`) that just records log messages (and does not output any):
 
 ```go
-logger, hook := NewNullLogger()
-logger.Error("Hello error")
+import(
+  "github.com/sirupsen/logrus"
+  "github.com/sirupsen/logrus/hooks/null"
+  "github.com/stretchr/testify/assert"
+  "testing"
+)
 
-assert.Equal(1, len(hook.Entries))
-assert.Equal(logrus.ErrorLevel, hook.LastEntry().Level)
-assert.Equal("Hello error", hook.LastEntry().Message)
+func TestSomething(t*testing.T){
+  logger, hook := null.NewNullLogger()
+  logger.Error("Helloerror")
 
-hook.Reset()
-assert.Nil(hook.LastEntry())
+  assert.Equal(t, 1, len(hook.Entries))
+  assert.Equal(t, logrus.ErrorLevel, hook.LastEntry().Level)
+  assert.Equal(t, "Helloerror", hook.LastEntry().Message)
+
+  hook.Reset()
+  assert.Nil(t, hook.LastEntry())
+}
 ```
 
 #### Fatal handlers
@@ -1,7 +1,7 @@
 package logrus
 
 // The following code was sourced and modified from the
-// https://bitbucket.org/tebeka/atexit package governed by the following license:
+// https://github.com/tebeka/atexit package governed by the following license:
 //
 // Copyright (c) 2012 Miki Tebeka <miki.tebeka@gmail.com>.
 //
@@ -44,7 +44,7 @@ var testprog = []byte(`
 package main
 
 import (
-       "github.com/Sirupsen/logrus"
+       "github.com/sirupsen/logrus"
        "flag"
        "fmt"
        "io/ioutil"
similarity index 83%
rename from vendor/github.com/Sirupsen/logrus/doc.go
rename to vendor/github.com/sirupsen/logrus/doc.go
index dddd5f8..da67aba 100644 (file)
@@ -7,7 +7,7 @@ The simplest way to use Logrus is simply the package-level exported logger:
   package main
 
   import (
-    log "github.com/Sirupsen/logrus"
+    log "github.com/sirupsen/logrus"
   )
 
   func main() {
@@ -21,6 +21,6 @@ The simplest way to use Logrus is simply the package-level exported logger:
 Output:
   time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10
 
-For a full guide visit https://github.com/Sirupsen/logrus
+For a full guide visit https://github.com/sirupsen/logrus
 */
 package logrus
similarity index 89%
rename from vendor/github.com/Sirupsen/logrus/entry.go
rename to vendor/github.com/sirupsen/logrus/entry.go
index 4edbe7a..320e5d5 100644 (file)
@@ -126,7 +126,7 @@ func (entry Entry) log(level Level, msg string) {
 }
 
 func (entry *Entry) Debug(args ...interface{}) {
-       if entry.Logger.Level >= DebugLevel {
+       if entry.Logger.level() >= DebugLevel {
                entry.log(DebugLevel, fmt.Sprint(args...))
        }
 }
@@ -136,13 +136,13 @@ func (entry *Entry) Print(args ...interface{}) {
 }
 
 func (entry *Entry) Info(args ...interface{}) {
-       if entry.Logger.Level >= InfoLevel {
+       if entry.Logger.level() >= InfoLevel {
                entry.log(InfoLevel, fmt.Sprint(args...))
        }
 }
 
 func (entry *Entry) Warn(args ...interface{}) {
-       if entry.Logger.Level >= WarnLevel {
+       if entry.Logger.level() >= WarnLevel {
                entry.log(WarnLevel, fmt.Sprint(args...))
        }
 }
@@ -152,20 +152,20 @@ func (entry *Entry) Warning(args ...interface{}) {
 }
 
 func (entry *Entry) Error(args ...interface{}) {
-       if entry.Logger.Level >= ErrorLevel {
+       if entry.Logger.level() >= ErrorLevel {
                entry.log(ErrorLevel, fmt.Sprint(args...))
        }
 }
 
 func (entry *Entry) Fatal(args ...interface{}) {
-       if entry.Logger.Level >= FatalLevel {
+       if entry.Logger.level() >= FatalLevel {
                entry.log(FatalLevel, fmt.Sprint(args...))
        }
        Exit(1)
 }
 
 func (entry *Entry) Panic(args ...interface{}) {
-       if entry.Logger.Level >= PanicLevel {
+       if entry.Logger.level() >= PanicLevel {
                entry.log(PanicLevel, fmt.Sprint(args...))
        }
        panic(fmt.Sprint(args...))
@@ -174,13 +174,13 @@ func (entry *Entry) Panic(args ...interface{}) {
 // Entry Printf family functions
 
 func (entry *Entry) Debugf(format string, args ...interface{}) {
-       if entry.Logger.Level >= DebugLevel {
+       if entry.Logger.level() >= DebugLevel {
                entry.Debug(fmt.Sprintf(format, args...))
        }
 }
 
 func (entry *Entry) Infof(format string, args ...interface{}) {
-       if entry.Logger.Level >= InfoLevel {
+       if entry.Logger.level() >= InfoLevel {
                entry.Info(fmt.Sprintf(format, args...))
        }
 }
@@ -190,7 +190,7 @@ func (entry *Entry) Printf(format string, args ...interface{}) {
 }
 
 func (entry *Entry) Warnf(format string, args ...interface{}) {
-       if entry.Logger.Level >= WarnLevel {
+       if entry.Logger.level() >= WarnLevel {
                entry.Warn(fmt.Sprintf(format, args...))
        }
 }
@@ -200,20 +200,20 @@ func (entry *Entry) Warningf(format string, args ...interface{}) {
 }
 
 func (entry *Entry) Errorf(format string, args ...interface{}) {
-       if entry.Logger.Level >= ErrorLevel {
+       if entry.Logger.level() >= ErrorLevel {
                entry.Error(fmt.Sprintf(format, args...))
        }
 }
 
 func (entry *Entry) Fatalf(format string, args ...interface{}) {
-       if entry.Logger.Level >= FatalLevel {
+       if entry.Logger.level() >= FatalLevel {
                entry.Fatal(fmt.Sprintf(format, args...))
        }
        Exit(1)
 }
 
 func (entry *Entry) Panicf(format string, args ...interface{}) {
-       if entry.Logger.Level >= PanicLevel {
+       if entry.Logger.level() >= PanicLevel {
                entry.Panic(fmt.Sprintf(format, args...))
        }
 }
@@ -221,13 +221,13 @@ func (entry *Entry) Panicf(format string, args ...interface{}) {
 // Entry Println family functions
 
 func (entry *Entry) Debugln(args ...interface{}) {
-       if entry.Logger.Level >= DebugLevel {
+       if entry.Logger.level() >= DebugLevel {
                entry.Debug(entry.sprintlnn(args...))
        }
 }
 
 func (entry *Entry) Infoln(args ...interface{}) {
-       if entry.Logger.Level >= InfoLevel {
+       if entry.Logger.level() >= InfoLevel {
                entry.Info(entry.sprintlnn(args...))
        }
 }
@@ -237,7 +237,7 @@ func (entry *Entry) Println(args ...interface{}) {
 }
 
 func (entry *Entry) Warnln(args ...interface{}) {
-       if entry.Logger.Level >= WarnLevel {
+       if entry.Logger.level() >= WarnLevel {
                entry.Warn(entry.sprintlnn(args...))
        }
 }
@@ -247,20 +247,20 @@ func (entry *Entry) Warningln(args ...interface{}) {
 }
 
 func (entry *Entry) Errorln(args ...interface{}) {
-       if entry.Logger.Level >= ErrorLevel {
+       if entry.Logger.level() >= ErrorLevel {
                entry.Error(entry.sprintlnn(args...))
        }
 }
 
 func (entry *Entry) Fatalln(args ...interface{}) {
-       if entry.Logger.Level >= FatalLevel {
+       if entry.Logger.level() >= FatalLevel {
                entry.Fatal(entry.sprintlnn(args...))
        }
        Exit(1)
 }
 
 func (entry *Entry) Panicln(args ...interface{}) {
-       if entry.Logger.Level >= PanicLevel {
+       if entry.Logger.level() >= PanicLevel {
                entry.Panic(entry.sprintlnn(args...))
        }
 }
@@ -1,7 +1,7 @@
 package main
 
 import (
-       "github.com/Sirupsen/logrus"
+       "github.com/sirupsen/logrus"
        // "os"
 )
 
@@ -1,7 +1,7 @@
 package main
 
 import (
-       "github.com/Sirupsen/logrus"
+       "github.com/sirupsen/logrus"
        "gopkg.in/gemnasium/logrus-airbrake-hook.v2"
 )
 
@@ -31,14 +31,14 @@ func SetFormatter(formatter Formatter) {
 func SetLevel(level Level) {
        std.mu.Lock()
        defer std.mu.Unlock()
-       std.Level = level
+       std.setLevel(level)
 }
 
 // GetLevel returns the standard logger level.
 func GetLevel() Level {
        std.mu.Lock()
        defer std.mu.Unlock()
-       return std.Level
+       return std.level()
 }
 
 // AddHook adds a hook to the standard logger hooks.
@@ -5,8 +5,8 @@
 ```go
 import (
   "log/syslog"
-  "github.com/Sirupsen/logrus"
-  logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog"
+  "github.com/sirupsen/logrus"
+  logrus_syslog "github.com/sirupsen/logrus/hooks/syslog"
 )
 
 func main() {
@@ -24,8 +24,8 @@ If you want to connect to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "
 ```go
 import (
   "log/syslog"
-  "github.com/Sirupsen/logrus"
-  logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog"
+  "github.com/sirupsen/logrus"
+  logrus_syslog "github.com/sirupsen/logrus/hooks/syslog"
 )
 
 func main() {
@@ -36,4 +36,4 @@ func main() {
     log.Hooks.Add(hook)
   }
 }
-```
\ No newline at end of file
+```
@@ -4,7 +4,7 @@ package logrus_syslog
 
 import (
        "fmt"
-       "github.com/Sirupsen/logrus"
+       "github.com/sirupsen/logrus"
        "log/syslog"
        "os"
 )
@@ -1,7 +1,7 @@
 package logrus_syslog
 
 import (
-       "github.com/Sirupsen/logrus"
+       "github.com/sirupsen/logrus"
        "log/syslog"
        "testing"
 )
diff --git a/vendor/github.com/sirupsen/logrus/hooks/test/test.go b/vendor/github.com/sirupsen/logrus/hooks/test/test.go
new file mode 100644 (file)
index 0000000..62c4845
--- /dev/null
@@ -0,0 +1,95 @@
+// The Test package is used for testing logrus. It is here for backwards
+// compatibility from when logrus' organization was upper-case. Please use
+// lower-case logrus and the `null` package instead of this one.
+package test
+
+import (
+       "io/ioutil"
+       "sync"
+
+       "github.com/sirupsen/logrus"
+)
+
+// Hook is a hook designed for dealing with logs in test scenarios.
+type Hook struct {
+       // Entries is an array of all entries that have been received by this hook.
+       // For safe access, use the AllEntries() method, rather than reading this
+       // value directly.
+       Entries []*logrus.Entry
+       mu      sync.RWMutex
+}
+
+// NewGlobal installs a test hook for the global logger.
+func NewGlobal() *Hook {
+
+       hook := new(Hook)
+       logrus.AddHook(hook)
+
+       return hook
+
+}
+
+// NewLocal installs a test hook for a given local logger.
+func NewLocal(logger *logrus.Logger) *Hook {
+
+       hook := new(Hook)
+       logger.Hooks.Add(hook)
+
+       return hook
+
+}
+
+// NewNullLogger creates a discarding logger and installs the test hook.
+func NewNullLogger() (*logrus.Logger, *Hook) {
+
+       logger := logrus.New()
+       logger.Out = ioutil.Discard
+
+       return logger, NewLocal(logger)
+
+}
+
+func (t *Hook) Fire(e *logrus.Entry) error {
+       t.mu.Lock()
+       defer t.mu.Unlock()
+       t.Entries = append(t.Entries, e)
+       return nil
+}
+
+func (t *Hook) Levels() []logrus.Level {
+       return logrus.AllLevels
+}
+
+// LastEntry returns the last entry that was logged or nil.
+func (t *Hook) LastEntry() *logrus.Entry {
+       t.mu.RLock()
+       defer t.mu.RUnlock()
+       i := len(t.Entries) - 1
+       if i < 0 {
+               return nil
+       }
+       // Make a copy, for safety
+       e := *t.Entries[i]
+       return &e
+}
+
+// AllEntries returns all entries that were logged.
+func (t *Hook) AllEntries() []*logrus.Entry {
+       t.mu.RLock()
+       defer t.mu.RUnlock()
+       // Make a copy so the returned value won't race with future log requests
+       entries := make([]*logrus.Entry, len(t.Entries))
+       for i, entry := range t.Entries {
+               // Make a copy, for safety
+               e := *entry
+               entries[i] = &e
+       }
+       return entries
+}
+
+// Reset removes all Entries from this test hook.
+func (t *Hook) Reset() {
+       t.mu.Lock()
+       defer t.mu.Unlock()
+       t.Entries = make([]*logrus.Entry, 0)
+}
@@ -3,7 +3,7 @@ package test
 import (
        "testing"
 
-       "github.com/Sirupsen/logrus"
+       "github.com/sirupsen/logrus"
        "github.com/stretchr/testify/assert"
 )
 
@@ -35,7 +35,7 @@ type JSONFormatter struct {
        //      FieldMap: FieldMap{
        //               FieldKeyTime: "@timestamp",
        //               FieldKeyLevel: "@level",
-       //               FieldKeyLevel: "@message",
+       //               FieldKeyMsg: "@message",
        //    },
        // }
        FieldMap FieldMap
@@ -47,7 +47,7 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
                switch v := v.(type) {
                case error:
                        // Otherwise errors are ignored by `encoding/json`
-                       // https://github.com/Sirupsen/logrus/issues/137
+                       // https://github.com/sirupsen/logrus/issues/137
                        data[k] = v.Error()
                default:
                        data[k] = v
similarity index 88%
rename from vendor/github.com/Sirupsen/logrus/logger.go
rename to vendor/github.com/sirupsen/logrus/logger.go
index b769f3d..370fff5 100644 (file)
@@ -4,6 +4,7 @@ import (
        "io"
        "os"
        "sync"
+       "sync/atomic"
 )
 
 type Logger struct {
@@ -112,7 +113,7 @@ func (logger *Logger) WithError(err error) *Entry {
 }
 
 func (logger *Logger) Debugf(format string, args ...interface{}) {
-       if logger.Level >= DebugLevel {
+       if logger.level() >= DebugLevel {
                entry := logger.newEntry()
                entry.Debugf(format, args...)
                logger.releaseEntry(entry)
@@ -120,7 +121,7 @@ func (logger *Logger) Debugf(format string, args ...interface{}) {
 }
 
 func (logger *Logger) Infof(format string, args ...interface{}) {
-       if logger.Level >= InfoLevel {
+       if logger.level() >= InfoLevel {
                entry := logger.newEntry()
                entry.Infof(format, args...)
                logger.releaseEntry(entry)
@@ -134,7 +135,7 @@ func (logger *Logger) Printf(format string, args ...interface{}) {
 }
 
 func (logger *Logger) Warnf(format string, args ...interface{}) {
-       if logger.Level >= WarnLevel {
+       if logger.level() >= WarnLevel {
                entry := logger.newEntry()
                entry.Warnf(format, args...)
                logger.releaseEntry(entry)
@@ -142,7 +143,7 @@ func (logger *Logger) Warnf(format string, args ...interface{}) {
 }
 
 func (logger *Logger) Warningf(format string, args ...interface{}) {
-       if logger.Level >= WarnLevel {
+       if logger.level() >= WarnLevel {
                entry := logger.newEntry()
                entry.Warnf(format, args...)
                logger.releaseEntry(entry)
@@ -150,7 +151,7 @@ func (logger *Logger) Warningf(format string, args ...interface{}) {
 }
 
 func (logger *Logger) Errorf(format string, args ...interface{}) {
-       if logger.Level >= ErrorLevel {
+       if logger.level() >= ErrorLevel {
                entry := logger.newEntry()
                entry.Errorf(format, args...)
                logger.releaseEntry(entry)
@@ -158,7 +159,7 @@ func (logger *Logger) Errorf(format string, args ...interface{}) {
 }
 
 func (logger *Logger) Fatalf(format string, args ...interface{}) {
-       if logger.Level >= FatalLevel {
+       if logger.level() >= FatalLevel {
                entry := logger.newEntry()
                entry.Fatalf(format, args...)
                logger.releaseEntry(entry)
@@ -167,7 +168,7 @@ func (logger *Logger) Fatalf(format string, args ...interface{}) {
 }
 
 func (logger *Logger) Panicf(format string, args ...interface{}) {
-       if logger.Level >= PanicLevel {
+       if logger.level() >= PanicLevel {
                entry := logger.newEntry()
                entry.Panicf(format, args...)
                logger.releaseEntry(entry)
@@ -175,7 +176,7 @@ func (logger *Logger) Panicf(format string, args ...interface{}) {
 }
 
 func (logger *Logger) Debug(args ...interface{}) {
-       if logger.Level >= DebugLevel {
+       if logger.level() >= DebugLevel {
                entry := logger.newEntry()
                entry.Debug(args...)
                logger.releaseEntry(entry)
@@ -183,7 +184,7 @@ func (logger *Logger) Debug(args ...interface{}) {
 }
 
 func (logger *Logger) Info(args ...interface{}) {
-       if logger.Level >= InfoLevel {
+       if logger.level() >= InfoLevel {
                entry := logger.newEntry()
                entry.Info(args...)
                logger.releaseEntry(entry)
@@ -197,7 +198,7 @@ func (logger *Logger) Print(args ...interface{}) {
 }
 
 func (logger *Logger) Warn(args ...interface{}) {
-       if logger.Level >= WarnLevel {
+       if logger.level() >= WarnLevel {
                entry := logger.newEntry()
                entry.Warn(args...)
                logger.releaseEntry(entry)
@@ -205,7 +206,7 @@ func (logger *Logger) Warn(args ...interface{}) {
 }
 
 func (logger *Logger) Warning(args ...interface{}) {
-       if logger.Level >= WarnLevel {
+       if logger.level() >= WarnLevel {
                entry := logger.newEntry()
                entry.Warn(args...)
                logger.releaseEntry(entry)
@@ -213,7 +214,7 @@ func (logger *Logger) Warning(args ...interface{}) {
 }
 
 func (logger *Logger) Error(args ...interface{}) {
-       if logger.Level >= ErrorLevel {
+       if logger.level() >= ErrorLevel {
                entry := logger.newEntry()
                entry.Error(args...)
                logger.releaseEntry(entry)
@@ -221,7 +222,7 @@ func (logger *Logger) Error(args ...interface{}) {
 }
 
 func (logger *Logger) Fatal(args ...interface{}) {
-       if logger.Level >= FatalLevel {
+       if logger.level() >= FatalLevel {
                entry := logger.newEntry()
                entry.Fatal(args...)
                logger.releaseEntry(entry)
@@ -230,7 +231,7 @@ func (logger *Logger) Fatal(args ...interface{}) {
 }
 
 func (logger *Logger) Panic(args ...interface{}) {
-       if logger.Level >= PanicLevel {
+       if logger.level() >= PanicLevel {
                entry := logger.newEntry()
                entry.Panic(args...)
                logger.releaseEntry(entry)
@@ -238,7 +239,7 @@ func (logger *Logger) Panic(args ...interface{}) {
 }
 
 func (logger *Logger) Debugln(args ...interface{}) {
-       if logger.Level >= DebugLevel {
+       if logger.level() >= DebugLevel {
                entry := logger.newEntry()
                entry.Debugln(args...)
                logger.releaseEntry(entry)
@@ -246,7 +247,7 @@ func (logger *Logger) Debugln(args ...interface{}) {
 }
 
 func (logger *Logger) Infoln(args ...interface{}) {
-       if logger.Level >= InfoLevel {
+       if logger.level() >= InfoLevel {
                entry := logger.newEntry()
                entry.Infoln(args...)
                logger.releaseEntry(entry)
@@ -260,7 +261,7 @@ func (logger *Logger) Println(args ...interface{}) {
 }
 
 func (logger *Logger) Warnln(args ...interface{}) {
-       if logger.Level >= WarnLevel {
+       if logger.level() >= WarnLevel {
                entry := logger.newEntry()
                entry.Warnln(args...)
                logger.releaseEntry(entry)
@@ -268,7 +269,7 @@ func (logger *Logger) Warnln(args ...interface{}) {
 }
 
 func (logger *Logger) Warningln(args ...interface{}) {
-       if logger.Level >= WarnLevel {
+       if logger.level() >= WarnLevel {
                entry := logger.newEntry()
                entry.Warnln(args...)
                logger.releaseEntry(entry)
@@ -276,7 +277,7 @@ func (logger *Logger) Warningln(args ...interface{}) {
 }
 
 func (logger *Logger) Errorln(args ...interface{}) {
-       if logger.Level >= ErrorLevel {
+       if logger.level() >= ErrorLevel {
                entry := logger.newEntry()
                entry.Errorln(args...)
                logger.releaseEntry(entry)
@@ -284,7 +285,7 @@ func (logger *Logger) Errorln(args ...interface{}) {
 }
 
 func (logger *Logger) Fatalln(args ...interface{}) {
-       if logger.Level >= FatalLevel {
+       if logger.level() >= FatalLevel {
                entry := logger.newEntry()
                entry.Fatalln(args...)
                logger.releaseEntry(entry)
@@ -293,7 +294,7 @@ func (logger *Logger) Fatalln(args ...interface{}) {
 }
 
 func (logger *Logger) Panicln(args ...interface{}) {
-       if logger.Level >= PanicLevel {
+       if logger.level() >= PanicLevel {
                entry := logger.newEntry()
                entry.Panicln(args...)
                logger.releaseEntry(entry)
@@ -306,3 +307,11 @@ func (logger *Logger) Panicln(args ...interface{}) {
 func (logger *Logger) SetNoLock() {
        logger.mu.Disable()
 }
+
+func (logger *Logger) level() Level {
+       return Level(atomic.LoadUint32((*uint32)(&logger.Level)))
+}
+
+func (logger *Logger) setLevel(level Level) {
+       atomic.StoreUint32((*uint32)(&logger.Level), uint32(level))
+}
similarity index 99%
rename from vendor/github.com/Sirupsen/logrus/logrus.go
rename to vendor/github.com/sirupsen/logrus/logrus.go
index e596691..dd38999 100644 (file)
@@ -10,7 +10,7 @@ import (
 type Fields map[string]interface{}
 
 // Level type
-type Level uint8
+type Level uint32
 
 // Convert the Level to a string. E.g. PanicLevel becomes "panic".
 func (level Level) String() string {
diff --git a/vendor/github.com/sirupsen/logrus/terminal_windows.go b/vendor/github.com/sirupsen/logrus/terminal_windows.go
new file mode 100644 (file)
index 0000000..7a33630
--- /dev/null
@@ -0,0 +1,82 @@
+// Based on ssh/terminal:
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build windows,!appengine
+
+package logrus
+
+import (
+       "bytes"
+       "errors"
+       "io"
+       "os"
+       "os/exec"
+       "strconv"
+       "strings"
+       "syscall"
+       "unsafe"
+)
+
+var kernel32 = syscall.NewLazyDLL("kernel32.dll")
+
+var (
+       procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
+       procSetConsoleMode = kernel32.NewProc("SetConsoleMode")
+)
+
+const (
+       enableProcessedOutput           = 0x0001
+       enableWrapAtEolOutput           = 0x0002
+       enableVirtualTerminalProcessing = 0x0004
+)
+
+func getVersion() (float64, error) {
+       stdout, stderr := &bytes.Buffer{}, &bytes.Buffer{}
+       cmd := exec.Command("cmd", "ver")
+       cmd.Stdout = stdout
+       cmd.Stderr = stderr
+       err := cmd.Run()
+       if err != nil {
+               return -1, err
+       }
+       
+       // The output should be like "Microsoft Windows [Version XX.X.XXXXXX]"
+       version := strings.Replace(stdout.String(), "\n", "", -1)
+       version = strings.Replace(version, "\r\n", "", -1)
+
+       x1 := strings.Index(version, "[Version")
+
+       if x1 == -1 || strings.Index(version, "]") == -1 {
+               return -1, errors.New("Can't determine Windows version")
+       }
+
+       return strconv.ParseFloat(version[x1+9:x1+13], 64)
+}
+
+func init() {
+       ver, err := getVersion()
+       if err != nil {
+               return
+       }
+
+       // Activate Virtual Processing for Windows CMD
+       // Info: https://msdn.microsoft.com/en-us/library/windows/desktop/ms686033(v=vs.85).aspx
+       if ver >= 10 {
+               handle := syscall.Handle(os.Stderr.Fd())
+               procSetConsoleMode.Call(uintptr(handle), enableProcessedOutput|enableWrapAtEolOutput|enableVirtualTerminalProcessing)
+       }
+}
+
+// IsTerminal returns true if stderr's file descriptor is a terminal.
+func IsTerminal(f io.Writer) bool {
+       switch v := f.(type) {
+       case *os.File:
+               var st uint32
+               r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(v.Fd()), uintptr(unsafe.Pointer(&st)), 0)
+               return r != 0 && e == 0
+       default:
+               return false
+       }
+}