mirror of https://github.com/sirupsen/logrus.git
Merge pull request #823 from mdittmer/fix-appengine
Fix AppEngine builds
This commit is contained in:
commit
568026db28
23
.travis.yml
23
.travis.yml
|
@ -26,3 +26,26 @@ matrix:
|
||||||
- go get golang.org/x/sys/windows
|
- go get golang.org/x/sys/windows
|
||||||
script:
|
script:
|
||||||
- go test -race -v ./...
|
- go test -race -v ./...
|
||||||
|
- go: 1.10.x
|
||||||
|
install:
|
||||||
|
- go get github.com/stretchr/testify/assert
|
||||||
|
- go get golang.org/x/crypto/ssh/terminal
|
||||||
|
- go get golang.org/x/sys/unix
|
||||||
|
- go get golang.org/x/sys/windows
|
||||||
|
script:
|
||||||
|
- go test -race -v -tags appengine ./...
|
||||||
|
- go: 1.11.x
|
||||||
|
env: GO111MODULE=on
|
||||||
|
install:
|
||||||
|
- go mod download
|
||||||
|
script:
|
||||||
|
- go test -race -v -tags appengine ./...
|
||||||
|
- go: 1.11.x
|
||||||
|
env: GO111MODULE=off
|
||||||
|
install:
|
||||||
|
- go get github.com/stretchr/testify/assert
|
||||||
|
- go get golang.org/x/crypto/ssh/terminal
|
||||||
|
- go get golang.org/x/sys/unix
|
||||||
|
- go get golang.org/x/sys/windows
|
||||||
|
script:
|
||||||
|
- go test -race -v -tags appengine ./...
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
package logrus_test
|
package logrus_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Example_basic() {
|
func Example_basic() {
|
||||||
var log = logrus.New()
|
var log = logrus.New()
|
||||||
log.Formatter = new(logrus.JSONFormatter)
|
log.Formatter = new(logrus.JSONFormatter)
|
||||||
log.Formatter = new(logrus.TextFormatter) //default
|
log.Formatter = new(logrus.TextFormatter) //default
|
||||||
|
log.Formatter.(*logrus.TextFormatter).DisableColors = true // remove colors
|
||||||
log.Formatter.(*logrus.TextFormatter).DisableTimestamp = true // remove timestamp from test output
|
log.Formatter.(*logrus.TextFormatter).DisableTimestamp = true // remove timestamp from test output
|
||||||
log.Level = logrus.DebugLevel
|
log.Level = logrus.DebugLevel
|
||||||
log.Out = os.Stdout
|
log.Out = os.Stdout
|
||||||
|
|
|
@ -3,16 +3,18 @@
|
||||||
package logrus_test
|
package logrus_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
slhooks "github.com/sirupsen/logrus/hooks/syslog"
|
|
||||||
"log/syslog"
|
"log/syslog"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
slhooks "github.com/sirupsen/logrus/hooks/syslog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// An example on how to use a hook
|
// An example on how to use a hook
|
||||||
func Example_hook() {
|
func Example_hook() {
|
||||||
var log = logrus.New()
|
var log = logrus.New()
|
||||||
log.Formatter = new(logrus.TextFormatter) // default
|
log.Formatter = new(logrus.TextFormatter) // default
|
||||||
|
log.Formatter.(*logrus.TextFormatter).DisableColors = true // remove colors
|
||||||
log.Formatter.(*logrus.TextFormatter).DisableTimestamp = true // remove timestamp from test output
|
log.Formatter.(*logrus.TextFormatter).DisableTimestamp = true // remove timestamp from test output
|
||||||
if sl, err := slhooks.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, ""); err != nil {
|
if sl, err := slhooks.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, ""); err != nil {
|
||||||
log.Hooks.Add(sl)
|
log.Hooks.Add(sl)
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
// Based on ssh/terminal:
|
||||||
|
// Copyright 2018 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 appengine
|
||||||
|
|
||||||
|
package logrus
|
||||||
|
|
||||||
|
import "io"
|
||||||
|
|
||||||
|
func initTerminal(w io.Writer) {
|
||||||
|
}
|
Loading…
Reference in New Issue