Class: Ibrain::LogQueryDepth

Inherits:
GraphQL::Analysis::AST::QueryDepth
  • Object
show all
Defined in:
app/graphql/ibrain/log_query_depth.rb

Instance Method Summary collapse

Instance Method Details

#resultObject



4
5
6
7
8
9
10
11
12
13
14
# File 'app/graphql/ibrain/log_query_depth.rb', line 4

def result
  query_depth = super
  current_user = query.context[:current_user]
  message = <<-RUBY
    [GraphQL Query Depth]: #{query_depth}
    [UserName]: #{current_user.try(:name)}
    [UserID]: #{current_user.try(:id)}
  RUBY

  Rails.logger.info(message)
end