Skip to content

Commit 0e66403

Browse files
committed
Merge branch 'master' of https://github.com/labstack/gommon
2 parents f9d5a06 + 35d2b9f commit 0e66403

File tree

4 files changed

+35
-27
lines changed

4 files changed

+35
-27
lines changed

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: go
22
go:
3-
- 1.5.2
3+
- 1.6
4+
- 1.7
45
- tip
56
before_install:
67
- go get github.com/modocache/gover
@@ -11,5 +12,9 @@ script:
1112
- go test -coverprofile=color.coverprofile ./color
1213
- go test -coverprofile=bytes.coverprofile ./bytes
1314
- go test -coverprofile=log.coverprofile ./log
15+
- go test -coverprofile=random.coverprofile ./random
1416
- $HOME/gopath/bin/gover
1517
- $HOME/gopath/bin/goveralls -coverprofile=gover.coverprofile -service=travis-ci
18+
matrix:
19+
allow_failures:
20+
- go: tip

glide.lock

Lines changed: 15 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

log/log.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
"strconv"
1515

16-
"github.com/mattn/go-colorable"
1716
"github.com/mattn/go-isatty"
1817
"github.com/valyala/fasttemplate"
1918

@@ -65,7 +64,7 @@ func New(prefix string) (l *Logger) {
6564
},
6665
}
6766
l.initLevels()
68-
l.SetOutput(colorable.NewColorableStdout())
67+
l.SetOutput(output())
6968
return
7069
}
7170

@@ -113,17 +112,21 @@ func (l *Logger) Output() io.Writer {
113112
return l.output
114113
}
115114

116-
func (l *Logger) SetHeader(h string) {
117-
l.template = l.newTemplate(h)
118-
}
119-
120115
func (l *Logger) SetOutput(w io.Writer) {
121116
l.output = w
122117
if w, ok := w.(*os.File); !ok || !isatty.IsTerminal(w.Fd()) {
123118
l.DisableColor()
124119
}
125120
}
126121

122+
func (l *Logger) Color() *color.Color {
123+
return l.color
124+
}
125+
126+
func (l *Logger) SetHeader(h string) {
127+
l.template = l.newTemplate(h)
128+
}
129+
127130
func (l *Logger) Print(i ...interface{}) {
128131
fmt.Fprintln(l.output, i...)
129132
}

log/white.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
package log
44

5-
import "io"
5+
import (
6+
"io"
7+
"os"
8+
)
69

710
func output() io.Writer {
8-
return os.stdout
11+
return os.Stdout
912
}

0 commit comments

Comments
 (0)