xing-backend 0.0.20 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xing/engine.rb +1 -0
- data/lib/xing/serializers/paged_list.rb +4 -0
- data/lib/xing/services/log_json_responses.rb +47 -0
- data/lib/xing/services.rb +1 -0
- data/spec_help/dummy/log/test.log +10 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83263b2da2ccaa9937f54b89d89db2614d0720b1
|
4
|
+
data.tar.gz: e60e38b8a1c57730d90c66076840a85d1712af31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b07bbb1e14d280327e461466e61ac3893b1f98ca5d16484448bcdc780fb24bc800011d85ec4d24e13f51842dd8d9c5239ef01af518025edc63e984dd660c070a
|
7
|
+
data.tar.gz: a495405c436e09f94fdd54be11643e52db8badaef0be96842337cef069400adedb216f1142857039d258a6b5dd9f79320afec077fe95535b23fbd5af9fc0e4b8
|
data/lib/xing/engine.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
module Xing::Services
|
2
|
+
class LogJson
|
3
|
+
APPJSON_RE = %r{^application/json}.freeze
|
4
|
+
|
5
|
+
def log_string(string)
|
6
|
+
obj = JSON.parse(string)
|
7
|
+
pretty_str = JSON.pretty_unparse(obj)
|
8
|
+
Rails.logger.debug(type_string + ": " + pretty_str)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class LogJsonRequests < LogJson
|
13
|
+
def initialize(app)
|
14
|
+
@app = app
|
15
|
+
end
|
16
|
+
|
17
|
+
def call(env)
|
18
|
+
if defined?(Rails) and env["CONTENT_TYPE"] =~ APPJSON_RE
|
19
|
+
log_string(env["rack.input"].read)
|
20
|
+
env["rack.input"].rewind
|
21
|
+
end
|
22
|
+
@app.call(env)
|
23
|
+
end
|
24
|
+
|
25
|
+
def type_string
|
26
|
+
"Request"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class LogJsonResponses < LogJson
|
31
|
+
def initialize(app)
|
32
|
+
@app = app
|
33
|
+
end
|
34
|
+
|
35
|
+
def call(env)
|
36
|
+
@app.call(env).tap do |status, headers, response|
|
37
|
+
if defined?(Rails) and headers["Content-Type"] =~ APPJSON_RE
|
38
|
+
log_string(response.body)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def type_string
|
44
|
+
"Response"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/xing/services.rb
CHANGED
@@ -141,3 +141,13 @@ ETHON: started MULTI
|
|
141
141
|
ETHON: performed MULTI
|
142
142
|
ETHON: started MULTI
|
143
143
|
ETHON: performed MULTI
|
144
|
+
ETHON: Libcurl initialized
|
145
|
+
ETHON: started MULTI
|
146
|
+
ETHON: performed MULTI
|
147
|
+
ETHON: started MULTI
|
148
|
+
ETHON: performed MULTI
|
149
|
+
ETHON: Libcurl initialized
|
150
|
+
ETHON: started MULTI
|
151
|
+
ETHON: performed MULTI
|
152
|
+
ETHON: started MULTI
|
153
|
+
ETHON: performed MULTI
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xing-backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Dorn
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-01-
|
14
|
+
date: 2016-01-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -250,6 +250,7 @@ files:
|
|
250
250
|
- lib/xing/services/error_converter.rb
|
251
251
|
- lib/xing/services/json_tree_lister.rb
|
252
252
|
- lib/xing/services/locator.rb
|
253
|
+
- lib/xing/services/log_json_responses.rb
|
253
254
|
- lib/xing/services/paged_wrapper.rb
|
254
255
|
- lib/xing/snapshot.rb
|
255
256
|
- lib/xing/snapshot/domain_helpers.rb
|
@@ -344,7 +345,7 @@ rdoc_options:
|
|
344
345
|
- "--main"
|
345
346
|
- doc/README
|
346
347
|
- "--title"
|
347
|
-
- xing-backend-0.0.
|
348
|
+
- xing-backend-0.0.21 Documentation
|
348
349
|
require_paths:
|
349
350
|
- lib/
|
350
351
|
required_ruby_version: !ruby/object:Gem::Requirement
|