bump logrus v1.4.2

full diff: https://github.com/sirupsen/logrus/compare/v1.4.1...v1.4.2

- sirupsen/logrus#946 Fix solaris build
- sirupsen/logrus#966 Add a checkTerminal for nacl to support running on play.golang.org
- sirupsen/logrus#969 fix build break for plan9

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-10-23 15:21:04 +02:00
parent 6a26d370ad
commit 9b92804656
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
9 changed files with 31 additions and 36 deletions

View File

@ -69,7 +69,7 @@ github.com/prometheus/common 7600349dcfe1abd18d72d3a17708
github.com/prometheus/procfs 7d6f385de8bea29190f15ba9931442a0eaef9af7
github.com/russross/blackfriday 1d6b8e9301e720b08a8938b8c25c018285885438
github.com/shurcooL/sanitized_anchor_name 10ef21a441db47d8b13ebcc5fd2310f636973c77
github.com/sirupsen/logrus 8bdbc7bcc01dcbb8ec23dc8a28e332258d25251f # v1.4.1
github.com/sirupsen/logrus 839c75faf7f98a33d445d181f3018b5c3409a45e # v1.4.2
github.com/spf13/cobra ef82de70bb3f60c65fb8eebacbb2d122ef517385 # v0.0.3
github.com/spf13/pflag 4cb166e4f25ac4e8016a3595bbf7ea2e9aa85a2c https://github.com/thaJeztah/pflag.git # temporary fork with https://github.com/spf13/pflag/pull/170 applied, which isn't merged yet upstream
github.com/syndtr/gocapability d98352740cb2c55f81556b63d4a1ec64c5a319c2

View File

@ -6,5 +6,5 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.1.1 // indirect
github.com/stretchr/testify v1.2.2
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33
golang.org/x/sys v0.0.0-20190422165155-953cdadca894
)

View File

@ -1,4 +1,4 @@
// +build js
// +build js nacl plan9
package logrus

View File

@ -1,4 +1,4 @@
// +build !appengine,!js,!windows
// +build !appengine,!js,!windows,!nacl,!plan9
package logrus

View File

@ -0,0 +1,11 @@
package logrus
import (
"golang.org/x/sys/unix"
)
// IsTerminal returns true if the given file descriptor is a terminal.
func isTerminal(fd int) bool {
_, err := unix.IoctlGetTermio(fd, unix.TCGETA)
return err == nil
}

View File

@ -6,15 +6,29 @@ import (
"io"
"os"
"syscall"
sequences "github.com/konsorten/go-windows-terminal-sequences"
)
func initTerminal(w io.Writer) {
switch v := w.(type) {
case *os.File:
sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true)
}
}
func checkIfTerminal(w io.Writer) bool {
var ret bool
switch v := w.(type) {
case *os.File:
var mode uint32
err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode)
return err == nil
ret = (err == nil)
default:
return false
ret = false
}
if ret {
initTerminal(w)
}
return ret
}

View File

@ -1,8 +0,0 @@
// +build !windows
package logrus
import "io"
func initTerminal(w io.Writer) {
}

View File

@ -1,18 +0,0 @@
// +build !appengine,!js,windows
package logrus
import (
"io"
"os"
"syscall"
sequences "github.com/konsorten/go-windows-terminal-sequences"
)
func initTerminal(w io.Writer) {
switch v := w.(type) {
case *os.File:
sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true)
}
}

View File

@ -84,10 +84,6 @@ type TextFormatter struct {
func (f *TextFormatter) init(entry *Entry) {
if entry.Logger != nil {
f.isTerminal = checkIfTerminal(entry.Logger.Out)
if f.isTerminal {
initTerminal(entry.Logger.Out)
}
}
}