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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb05e74645b5050779fc3bcebc5acbce02e24dfba652facb29ab0635c03fc019
4
- data.tar.gz: 4bb1019ebd28ee2dbd2fd5e2722bb577c8e1477e83f3f2cc74e17b8087145169
3
+ metadata.gz: 85b7e5a846f20c535b2886912a8ec1d23d7aaf34392a16e448c0112441283134
4
+ data.tar.gz: 786c31b77ae9798b06f7c4f8fcf9a8fc230fce75fe6b7235f4ba936c70ef211b
5
5
  SHA512:
6
- metadata.gz: 6b824013f50a50e4916e57442ffa5d1f9a1ca6322c68f5b6c9e90a7252e1ae38b1876ea53e8657f071b3f47d4a1a6d836150a2d52af94d0b858e4d7eee2766e7
7
- data.tar.gz: ea792f760e85c51327442c93238cb496129e1d025a70d0bbbf95b4ce681e91022b3ff0007f8f9c4f8766447dec4b7766faea92560ff740b3ef61a6fa2e35bcb5
6
+ metadata.gz: 5454918e05d841145c28c57da2d2559cd83d7839221bd33eb0f8be1c3890363c03321cddd23f2773fd8e0774d7f7eea1ad5e6b2fc238ce7b5494e153aeb015ef
7
+ data.tar.gz: 9b4e01f8fbe54fb5f36462601b64065da700c6d581a1f04cbbda21658f9278f2d88cb67ac58c10764f208723f95e4eb7c32a6ccf31e46fcaf461b70eb6b3ce14
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- getaround_utils (0.1.1)
4
+ getaround_utils (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -4,7 +4,7 @@ Backend shared utility classes
4
4
 
5
5
  ## Railties
6
6
 
7
- ### `GetaroundUtils::Railties::Lograge`
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](getaround_utils/spec/getaround_utils/railties/lograge_spec.rb)
15
+ For more details, [read the spec](spec/getaround_utils/railties/lograge_spec.rb)
16
16
 
17
- ### `GetaroundUtils::Railties::KeyValueLogTags`
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/railties/key_value_log_tags'
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](getaround_utils/spec/getaround_utils/railties/key_value_log_tags.rb)
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
- ### `GetaroundUtils::LogFormatters::DeepKeyValue`
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](getaround_utils/spec/getaround_utils/log_formatters/deep_key_value_spec.rb)
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::Railties; end
5
+ module GetaroundUtils::Patches; end
6
6
 
7
- class GetaroundUtils::Railties::KeyValueLogTags < Rails::Railtie
8
- module TaggedLoggingFormatterKeyValueLogTags
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 RackLoggerKeyValueLogTags
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({ tag => request.send(tag) })
22
+ @kv_formatter.call(tag => request.send(tag))
23
23
  else
24
- @kv_formatter.call({ tag => tag })
24
+ @kv_formatter.call(tag => tag)
25
25
  end
26
26
  end
27
27
  end
28
28
  end
29
29
 
30
- initializer 'getaround_utils.action_controller' do
31
- ActiveSupport::TaggedLogging::Formatter.prepend TaggedLoggingFormatterKeyValueLogTags
32
- Rails::Rack::Logger.prepend RackLoggerKeyValueLogTags
30
+ def self.enable
31
+ ActiveSupport::TaggedLogging::Formatter.prepend TaggedLoggingFormatter
32
+ Rails::Rack::Logger.prepend RackLogger
33
33
  end
34
- end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module GetaroundUtils
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  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.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-06 00:00:00.000000000 Z
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/railties/key_value_log_tags.rb
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