Class: GraphQL::Client::LogSubscriber
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
ActiveSupport::LogSubscriber
|
|
Instance Chain:
self,
ActiveSupport::LogSubscriber
|
|
Inherits: |
ActiveSupport::LogSubscriber
|
Defined in: | lib/graphql/client/log_subscriber.rb |
Overview
Public: Logger for “*.graphql” notification events.
Logs GraphQL queries to Rails logger.
UsersController::ShowQuery QUERY (123ms)
UsersController::UpdateMutation MUTATION (456ms)
Enable GraphQL ::GraphQL::Client
query logging.
require "graphql/client/log_subscriber"
GraphQL::Client::LogSubscriber.attach_to :graphql
Instance Method Summary
Instance Method Details
#error(event)
[ GitHub ]# File 'lib/graphql/client/log_subscriber.rb', line 31
def error(event) logger.error do name = event.payload[:operation_name].gsub("__", "::") = event.payload[: ] color("#{name} ERROR: #{}", nil, true) end end
#query(event)
[ GitHub ]# File 'lib/graphql/client/log_subscriber.rb', line 19
def query(event) logger.info do name = event.payload[:operation_name].gsub("__", "::") type = event.payload[:operation_type].upcase color("#{name} #{type} (#{event.duration.round(1)}ms)", nil, true) end logger.debug do event.payload[:document].to_query_string end end