Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Config propogation from gqlserver to graphql-go #10

Merged
merged 1 commit into from
Apr 9, 2020

Conversation

abhif22
Copy link

@abhif22 abhif22 commented Apr 8, 2020

Through this PR I intend to introduce the following changes:

  1. Added method EnablePanicLogging which propogate the config from gqlserver app
  2. Create a custom logger which has a field corresponding to config from gqlserver. This field is set in above method to true. When set to true the logs will contain detailed info on query and variables over and above the stack trace from panic otherwise logs will contain just the stack trace.
  3. CustomLogger implements interface Logger and overrided method LogPanic

log/log.go Outdated
const size = 64 << 10
buf := make([]byte, size)
buf = buf[:runtime.Stack(buf, false)]
if l.IsPanicLoggingEnabled {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're logging either way, may rename the toggle to VerbosePanicLog

msg := fmt.Sprintf("graphql: panic occurred: %v\n%s", value, buf)
if l.VerbosePanicLog {
 msg = fmt.Sprintf("%s\n\n%s", msg, buf)
}

log.Printf(msg)

@abhif22 abhif22 changed the title Added a method to act as an config propogation interface between gqls… Config propogation from gqlserver to graphql-go Apr 8, 2020
@abhif22 abhif22 force-pushed the gqlserver_graphqlgo_config_interface branch from 550f14d to 9ca2ea2 Compare April 8, 2020 15:44
@abhif22 abhif22 merged commit 71f5ef2 into logPanicRequests Apr 9, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants