[Awesome Ruby Gem GraphQL] Use graphql-rails_logger gem to inspect GraphQL queries in a more readable format
GraphQL::RailsLogger
This gem allows you to inspect graphql queries in a more readable format.
This…
becomes this …
Installation
You can install it as a gem:
1 | gem install graphql-rails_logger |
or add it into a Gemfile (Bundler):
1 | # Gemfile |
Then, run bundle install
.
1 | bundle install |
Configuration
By default this gem formats params only for GraphqlController#execute
.
If you want to change this behaviour, add config/initializers/graphql_rails_logger.rb
file and set proper controller and actions like this:
1 | # config/initializers/graphql_rails_logger.rb |
There is an option to suppress (hide) the GraphQL Introspection Query from the console output. This may be helpful to declutter the console during client testing as these can be rather lengthy.
1 | # config/initializers/graphql_rails_logger.rb |
The theme can be configured as well. The theme is applied using the rouge gem, where all available options can be found. The default value is Rouge::Themes::ThankfulEyes.new
.
1 | # config/initializers/graphql_rails_logger.rb |
References
[3] GraphQL - Related Projects - https://graphql-ruby.org/related_projects.html