getaround_utils 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +10 -7
- data/lib/getaround_utils/{railties → patches}/key_value_log_tags.rb +10 -10
- data/lib/getaround_utils/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85b7e5a846f20c535b2886912a8ec1d23d7aaf34392a16e448c0112441283134
|
4
|
+
data.tar.gz: 786c31b77ae9798b06f7c4f8fcf9a8fc230fce75fe6b7235f4ba936c70ef211b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5454918e05d841145c28c57da2d2559cd83d7839221bd33eb0f8be1c3890363c03321cddd23f2773fd8e0774d7f7eea1ad5e6b2fc238ce7b5494e153aeb015ef
|
7
|
+
data.tar.gz: 9b4e01f8fbe54fb5f36462601b64065da700c6d581a1f04cbbda21658f9278f2d88cb67ac58c10764f208723f95e4eb7c32a6ccf31e46fcaf461b70eb6b3ce14
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Backend shared utility classes
|
|
4
4
|
|
5
5
|
## Railties
|
6
6
|
|
7
|
-
###
|
7
|
+
### GetaroundUtils::Railties::Lograge
|
8
8
|
|
9
9
|
Enables lograge (http logs) with favored default.
|
10
10
|
```
|
@@ -12,25 +12,28 @@ Enables lograge (http logs) with favored default.
|
|
12
12
|
require 'getaround_utils/railties/lograge'
|
13
13
|
```
|
14
14
|
|
15
|
-
For more details, [read the spec](
|
15
|
+
For more details, [read the spec](spec/getaround_utils/railties/lograge_spec.rb)
|
16
16
|
|
17
|
-
|
17
|
+
## Patches
|
18
|
+
|
19
|
+
### GetaroundUtils::Patches::KeyValueLogTags
|
18
20
|
|
19
21
|
Enables parse-able key-value tags in ActiveRecord::TaggedLogger
|
20
22
|
```
|
21
23
|
# config/application.rb
|
22
|
-
require 'getaround_utils/
|
24
|
+
require 'getaround_utils/patches/key_value_log_tags'
|
25
|
+
GetaroundUtils::Patches::KeyValueLogTags.enable
|
23
26
|
```
|
24
27
|
|
25
|
-
For more details, [read the spec](
|
28
|
+
For more details, [read the spec](spec/getaround_utils/patches/key_value_log_tags_spec.rb)
|
26
29
|
|
27
30
|
## Misc
|
28
31
|
|
29
|
-
###
|
32
|
+
### GetaroundUtils::LogFormatters::DeepKeyValue
|
30
33
|
|
31
34
|
This log formatter will serialize an object of any depth into a key-value string.
|
32
35
|
It supports basic scalars (ie: `Hash`,`Array`,`Numeric`,`String`) and will call "#inspect" for any other type.
|
33
36
|
|
34
|
-
For more details, [read the spec](
|
37
|
+
For more details, [read the spec](spec/getaround_utils/log_formatters/deep_key_value_spec.rb)
|
35
38
|
|
36
39
|
|
@@ -2,16 +2,16 @@ require 'rails/railtie'
|
|
2
2
|
require 'getaround_utils/log_formatters/deep_key_value'
|
3
3
|
|
4
4
|
module GetaroundUtils; end
|
5
|
-
module GetaroundUtils::
|
5
|
+
module GetaroundUtils::Patches; end
|
6
6
|
|
7
|
-
class GetaroundUtils::
|
8
|
-
module
|
7
|
+
class GetaroundUtils::Patches::KeyValueLogTags
|
8
|
+
module TaggedLoggingFormatter
|
9
9
|
def tags_text
|
10
10
|
@tags_text ||= "#{current_tags.join(' ')} " if current_tags.any?
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
module
|
14
|
+
module RackLogger
|
15
15
|
def compute_tags(request)
|
16
16
|
@kv_formatter ||= GetaroundUtils::LogFormatters::DeepKeyValue.new
|
17
17
|
@taggers.collect do |tag|
|
@@ -19,16 +19,16 @@ class GetaroundUtils::Railties::KeyValueLogTags < Rails::Railtie
|
|
19
19
|
when Proc
|
20
20
|
@kv_formatter.call(tag.call(request))
|
21
21
|
when Symbol
|
22
|
-
@kv_formatter.call(
|
22
|
+
@kv_formatter.call(tag => request.send(tag))
|
23
23
|
else
|
24
|
-
@kv_formatter.call(
|
24
|
+
@kv_formatter.call(tag => tag)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
ActiveSupport::TaggedLogging::Formatter.prepend
|
32
|
-
Rails::Rack::Logger.prepend
|
30
|
+
def self.enable
|
31
|
+
ActiveSupport::TaggedLogging::Formatter.prepend TaggedLoggingFormatter
|
32
|
+
Rails::Rack::Logger.prepend RackLogger
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getaround_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Drivy
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-11-
|
12
|
+
date: 2019-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -190,7 +190,7 @@ files:
|
|
190
190
|
- lib/getaround_utils.rb
|
191
191
|
- lib/getaround_utils/log_formatters.rb
|
192
192
|
- lib/getaround_utils/log_formatters/deep_key_value.rb
|
193
|
-
- lib/getaround_utils/
|
193
|
+
- lib/getaround_utils/patches/key_value_log_tags.rb
|
194
194
|
- lib/getaround_utils/railties/lograge.rb
|
195
195
|
- lib/getaround_utils/version.rb
|
196
196
|
homepage: https://github.com/drivy
|