Skip to content

Commit

Permalink
Review nit + using proper logger...
Browse files Browse the repository at this point in the history
  • Loading branch information
bombela committed Sep 9, 2016
1 parent e84805b commit 8bb3d0e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions transport/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ package http

import (
"fmt"
"log"
"net/http"
"runtime/debug"
"time"

"code.uber.internal/go-common.git/x/log"

"github.com/yarpc/yarpc-go/internal/baggage"
"github.com/yarpc/yarpc-go/internal/errors"
"github.com/yarpc/yarpc-go/internal/request"
Expand Down Expand Up @@ -111,7 +110,7 @@ func (h handler) callHandler(w http.ResponseWriter, req *http.Request, start tim
// We recover panics from the user handler.
defer func() {
if r := recover(); r != nil {
log.Errorf("Handler panicked: %v\n%s", r, debug.Stack())
log.Printf("Handler panicked: %v\n%s", r, debug.Stack())
returnErr = fmt.Errorf("panic: %v", r)
}
}()
Expand Down
3 changes: 1 addition & 2 deletions transport/http/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ func TestHandlerInternalFailure(t *testing.T) {

type panickedHandler struct{}

func (th panickedHandler) Handle(context.Context, transport.Options,
*transport.Request, transport.ResponseWriter) error {
func (th panickedHandler) Handle(context.Context, transport.Options, *transport.Request, transport.ResponseWriter) error {
panic("oops I panicked!")
}

Expand Down
5 changes: 2 additions & 3 deletions transport/tchannel/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ package tchannel

import (
"fmt"
"log"
"runtime/debug"
"time"

"code.uber.internal/go-common.git/x/log"

"github.com/yarpc/yarpc-go/internal/encoding"
"github.com/yarpc/yarpc-go/internal/errors"
"github.com/yarpc/yarpc-go/internal/request"
Expand Down Expand Up @@ -164,7 +163,7 @@ func (h handler) callHandler(ctx context.Context, call inboundCall, now time.Tim
// We recover panics from the user handler.
defer func() {
if r := recover(); r != nil {
log.Errorf("Handler panicked: %v\n%s", r, debug.Stack())
log.Printf("Handler panicked: %v\n%s", r, debug.Stack())
returnErr = fmt.Errorf("panic: %v", r)
}
}()
Expand Down

0 comments on commit 8bb3d0e

Please sign in to comment.