File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -16,11 +16,18 @@ class Client
1616 # GraphQL::Client::LogSubscriber.attach_to :graphql
1717 #
1818 class LogSubscriber < ActiveSupport ::LogSubscriber
19+ SHOULD_USE_KWARGS = private_instance_methods . include? ( :mode_from )
20+
1921 def query ( event )
2022 logger . info do
2123 name = event . payload [ :operation_name ] . gsub ( "__" , "::" )
2224 type = event . payload [ :operation_type ] . upcase
23- color ( "#{ name } #{ type } (#{ event . duration . round ( 1 ) } ms)" , nil , true )
25+
26+ if SHOULD_USE_KWARGS
27+ color ( "#{ name } #{ type } (#{ event . duration . round ( 1 ) } ms)" , nil , bold : true )
28+ else
29+ color ( "#{ name } #{ type } (#{ event . duration . round ( 1 ) } ms)" , nil , true )
30+ end
2431 end
2532
2633 logger . debug do
@@ -32,7 +39,12 @@ def error(event)
3239 logger . error do
3340 name = event . payload [ :operation_name ] . gsub ( "__" , "::" )
3441 message = event . payload [ :message ]
35- color ( "#{ name } ERROR: #{ message } " , nil , true )
42+
43+ if SHOULD_USE_KWARGS
44+ color ( "#{ name } ERROR: #{ message } " , nil , bold : true )
45+ else
46+ color ( "#{ name } ERROR: #{ message } " , nil , true )
47+ end
3648 end
3749 end
3850 end
You can’t perform that action at this time.
0 commit comments