From c6716e030c02f316b887c1d3ee4b443aa3ab6afd Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 1 Apr 2022 00:23:19 +0200 Subject: Update dependencies (#1784) --- .../github.com/graph-gophers/graphql-go/log/log.go | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 vendor/github.com/graph-gophers/graphql-go/log/log.go (limited to 'vendor/github.com/graph-gophers/graphql-go/log') diff --git a/vendor/github.com/graph-gophers/graphql-go/log/log.go b/vendor/github.com/graph-gophers/graphql-go/log/log.go new file mode 100644 index 00000000..bdada874 --- /dev/null +++ b/vendor/github.com/graph-gophers/graphql-go/log/log.go @@ -0,0 +1,23 @@ +package log + +import ( + "context" + "log" + "runtime" +) + +// Logger is the interface used to log panics that occur during query execution. It is settable via graphql.ParseSchema +type Logger interface { + LogPanic(ctx context.Context, value interface{}) +} + +// DefaultLogger is the default logger used to log panics that occur during query execution +type DefaultLogger struct{} + +// LogPanic is used to log recovered panic values that occur during query execution +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\ncontext: %v", value, buf, ctx) +} -- cgit v1.2.3