graphql-rails_logger 1.2.2 → 1.2.4
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 +24 -7
- data/lib/graphql/rails_logger/version.rb +1 -1
- metadata +7 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a4170a2f3798e445eee7dc9218a8ae96bfb601dd597de401d61808813ffc1ca
|
4
|
+
data.tar.gz: eeb5e9549ea985c017efb17e12295a5c70bd7c01ca607f60bf68cb2b3cc13a83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc1edeb5664923de70765e216072d8b83c8d5f084f2cf0f47fd1fc3afa605dd9b99258371bd7584b5497752d19bc3f2a9f1822a7ad96aa7c07f65df137ab2dcf
|
7
|
+
data.tar.gz: 149eba487f731ff802b1662e65c02b1bfb9e079d701c7843234c05b62531e48370981e912567f143f85ac0178d2fbbb4063b61db77ffae80cd81e92645be10f0
|
@@ -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
|
-
next if config.skip_introspection_query && data['query']
|
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.4
|
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: 2023-01-13 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,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
136
|
- !ruby/object:Gem::Version
|
139
137
|
version: '0'
|
140
138
|
requirements: []
|
141
|
-
|
142
|
-
|
143
|
-
signing_key:
|
139
|
+
rubygems_version: 3.3.25
|
140
|
+
signing_key:
|
144
141
|
specification_version: 4
|
145
142
|
summary: Pretty logger for Rails + GraphQL applications.
|
146
143
|
test_files: []
|