Skip to content

Commit

Permalink
Merge pull request inconshreveable#86 from kevinburke/fprint
Browse files Browse the repository at this point in the history
use consecutive WriteString calls instead of Fprintf
  • Loading branch information
inconshreveable authored Jun 21, 2016
2 parents c94d940 + e3b29d3 commit 8463c3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 3 additions & 1 deletion format.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ func logfmt(buf *bytes.Buffer, ctx []interface{}, color int) {
if color > 0 {
fmt.Fprintf(buf, "\x1b[%dm%s\x1b[0m=%s", color, k, v)
} else {
fmt.Fprintf(buf, "%s=%s", k, v)
buf.WriteString(k)
buf.WriteByte('=')
buf.WriteString(v)
}
}

Expand Down
5 changes: 2 additions & 3 deletions log15_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,13 @@ func TestNetHandler(t *testing.T) {
go func() {
c, err := l.Accept()
if err != nil {
t.Errorf("Failed to accept conneciton: %v", err)
return
t.Fatalf("Failed to accept connection: %v", err)
}

rd := bufio.NewReader(c)
s, err := rd.ReadString('\n')
if err != nil {
t.Errorf("Failed to read string: %v", err)
t.Fatalf("Failed to read string: %v", err)
}

got := s[27:]
Expand Down

0 comments on commit 8463c3b

Please sign in to comment.