Skip to content

Commit

Permalink
Print context to panic log
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanp committed Oct 8, 2019
1 parent 3e8838d commit 01c95b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ type Logger interface {
type DefaultLogger struct{}

// LogPanic is used to log recovered panic values that occur during query execution
func (l *DefaultLogger) LogPanic(_ context.Context, value interface{}) {
func (l *DefaultLogger) LogPanic(ctx context.Context, value interface{}) {
const size = 64 << 10
buf := make([]byte, size)
buf = buf[:runtime.Stack(buf, false)]
log.Printf("graphql: panic occurred: %v\n%s", value, buf)
log.Printf("graphql: panic occurred: %v\n%s\ncontext: %v", value, buf, ctx)
}

0 comments on commit 01c95b0

Please sign in to comment.