graphql-rails_logger 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/graphql-rails_logger.gemspec +0 -2
- data/lib/graphql/rails_logger/subscriber.rb +23 -6
- data/lib/graphql/rails_logger/version.rb +1 -1
- metadata +7 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec122c5449dca8d9c4ad3cbfcf566b3fb326f3dda9e4ab873780a4789e716ae4
|
4
|
+
data.tar.gz: 37797d6232ce4e3befc9138d71a9fea3596d8b888f13917eb5221ef9c8709187
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52b519e43fd717f8235ec0ab27014cacec433561560b87c17288e657d0109f71aae30ccd0966c7cd0cabca534c586d349030616a3f411a3fa188e490e161b1a7
|
7
|
+
data.tar.gz: 44f1c66f08bdfbdfd5f6089ebbe1e9e0a25dc5e26528e4c93dfe69e0beb75e1f413a5a249084bb584841fe977f1a8d9398b7d0478571fbe2ff38113e9f28faf9
|
@@ -16,8 +16,6 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
17
|
f.match(%r{^(test|spec|features)/})
|
18
18
|
end
|
19
|
-
spec.bindir = 'bin'
|
20
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
19
|
spec.require_paths = ['lib']
|
22
20
|
|
23
21
|
spec.add_dependency 'rouge', '~> 3.0'
|
@@ -35,19 +35,36 @@ module GraphQL
|
|
35
35
|
query_lexer = Rouge::Lexers::GraphQL.new
|
36
36
|
variables_lexer = Rouge::Lexers::Ruby.new
|
37
37
|
|
38
|
-
(params['_json'] || [params.slice('query', 'variables')]).each do |data|
|
38
|
+
(params['_json'] || [params.slice('query', 'variables', 'extensions')]).each do |data|
|
39
39
|
|
40
40
|
next if config.skip_introspection_query && data['query'].index(/query IntrospectionQuery/)
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
# Cleanup and indent params for logging
|
43
|
+
query = indent(data.fetch('query', ''))
|
44
|
+
variables = indent(pretty(data.fetch('variables', '')))
|
45
|
+
extensions = indent(pretty(data.fetch('extensions', '')))
|
46
|
+
|
47
|
+
info "\nVariables:\n#{formatter.format(variables_lexer.lex(variables))}" if variables.present?
|
48
|
+
info "\nQuery:\n#{formatter.format(query_lexer.lex(query))}" if query.present?
|
49
|
+
info "\nExtensions:\n#{formatter.format(variables_lexer.lex(extensions))}" if extensions.present?
|
46
50
|
end
|
47
51
|
else
|
48
|
-
info "
|
52
|
+
info "\nParameters:\n#{params.inspect}" unless params.empty?
|
49
53
|
end
|
50
54
|
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def indent(data)
|
59
|
+
data.lines.map { |line| " #{line}" }.join.chomp
|
60
|
+
end
|
61
|
+
|
62
|
+
def pretty(data)
|
63
|
+
return '' if data.blank?
|
64
|
+
|
65
|
+
data = JSON.parse(data) if data.is_a?(String)
|
66
|
+
PP.pp(data, '')
|
67
|
+
end
|
51
68
|
end
|
52
69
|
end
|
53
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-rails_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JetRuby
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rouge
|
@@ -97,9 +97,7 @@ dependencies:
|
|
97
97
|
description: Display GraphQL queries in a more readable format.
|
98
98
|
email:
|
99
99
|
- engineering@jetruby.com
|
100
|
-
executables:
|
101
|
-
- console
|
102
|
-
- setup
|
100
|
+
executables: []
|
103
101
|
extensions: []
|
104
102
|
extra_rdoc_files: []
|
105
103
|
files:
|
@@ -123,7 +121,7 @@ homepage: https://github.com/jetruby/graphql-rails_logger
|
|
123
121
|
licenses:
|
124
122
|
- MIT
|
125
123
|
metadata: {}
|
126
|
-
post_install_message:
|
124
|
+
post_install_message:
|
127
125
|
rdoc_options: []
|
128
126
|
require_paths:
|
129
127
|
- lib
|
@@ -138,9 +136,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
136
|
- !ruby/object:Gem::Version
|
139
137
|
version: '0'
|
140
138
|
requirements: []
|
141
|
-
rubyforge_project:
|
139
|
+
rubyforge_project:
|
142
140
|
rubygems_version: 2.7.3
|
143
|
-
signing_key:
|
141
|
+
signing_key:
|
144
142
|
specification_version: 4
|
145
143
|
summary: Pretty logger for Rails + GraphQL applications.
|
146
144
|
test_files: []
|