lograge 0.7.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lograge/version.rb +1 -1
  3. data/lib/lograge.rb +15 -3
  4. metadata +21 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 794cb4f90104c70ec130d7e76616fd5f2f98d635
4
- data.tar.gz: 849237755782f80091e100da8980f2eba36e63d3
3
+ metadata.gz: c08e18fab6469f05e1b5b714dad91391549951b7
4
+ data.tar.gz: 5f1222270129c86b9e8d59dfad4c6a97ff914225
5
5
  SHA512:
6
- metadata.gz: ae07fa3866c8deeb9887dee23f8be3b2d8908b55c4adfb1c33e514e49f182077517ea74fca08ecffdca8d133bfb96c68159407092e319a8685be42f31e6fd530
7
- data.tar.gz: d1df2bb0c4f4e6c5ae392022f43b11d58fcd70676f6842fd469e74329d2da40d4af68307df8d90699cccc91f29e8f3890f2efb5c04f7b1169bb01c8410bbdcae
6
+ metadata.gz: 379a5c2acfb86f0a1e8fc884cabf4c5b4d837fae01594fb50171e8e7219ab530a052a9d9f9a55fda584d5c125f2d7a37f0cfaa32418130a596a06392d60ec9ea
7
+ data.tar.gz: 6157c642d52cf159dcd1324756ad255bb5e4ae946d58ad52ed625d0efe7f40a3e146ae52138796400a304cbd4ed4474301bc3ea37dab70ce139c1c8425f83ecd
@@ -1,3 +1,3 @@
1
1
  module Lograge
2
- VERSION = '0.7.1'.freeze
2
+ VERSION = '0.8.0'.freeze
3
3
  end
data/lib/lograge.rb CHANGED
@@ -144,11 +144,23 @@ module Lograge
144
144
 
145
145
  def setup_custom_payload
146
146
  return unless lograge_config.custom_payload_method.respond_to?(:call)
147
- base_controller_class = lograge_config.base_controller_class.try(:constantize) || ActionController::Base
148
- append_payload_method = base_controller_class.instance_method(:append_info_to_payload)
147
+
148
+ base_controller_classes = Array(lograge_config.base_controller_class)
149
+ base_controller_classes.map! { |klass| klass.try(:constantize) }
150
+ if base_controller_classes.empty?
151
+ base_controller_classes << ActionController::Base
152
+ end
153
+
154
+ base_controller_classes.each do |base_controller_class|
155
+ extend_base_controller_class(base_controller_class)
156
+ end
157
+ end
158
+
159
+ def extend_base_controller_class(klass)
160
+ append_payload_method = klass.instance_method(:append_info_to_payload)
149
161
  custom_payload_method = lograge_config.custom_payload_method
150
162
 
151
- base_controller_class.send(:define_method, :append_info_to_payload) do |payload|
163
+ klass.send(:define_method, :append_info_to_payload) do |payload|
152
164
  append_payload_method.bind(self).call(payload)
153
165
  payload[:custom_payload] = custom_payload_method.call(self)
154
166
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lograge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Meyer
@@ -9,20 +9,20 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-09-19 00:00:00.000000000 Z
12
+ date: 2018-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
@@ -43,74 +43,74 @@ dependencies:
43
43
  name: activesupport
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '4'
49
- - - <
49
+ - - "<"
50
50
  - !ruby/object:Gem::Version
51
51
  version: '5.2'
52
52
  type: :runtime
53
53
  prerelease: false
54
54
  version_requirements: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - '>='
56
+ - - ">="
57
57
  - !ruby/object:Gem::Version
58
58
  version: '4'
59
- - - <
59
+ - - "<"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '5.2'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: actionpack
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '4'
69
- - - <
69
+ - - "<"
70
70
  - !ruby/object:Gem::Version
71
71
  version: '5.2'
72
72
  type: :runtime
73
73
  prerelease: false
74
74
  version_requirements: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - '>='
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
78
  version: '4'
79
- - - <
79
+ - - "<"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '5.2'
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: railties
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '4'
89
- - - <
89
+ - - "<"
90
90
  - !ruby/object:Gem::Version
91
91
  version: '5.2'
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '4'
99
- - - <
99
+ - - "<"
100
100
  - !ruby/object:Gem::Version
101
101
  version: '5.2'
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: request_store
104
104
  requirement: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - ~>
106
+ - - "~>"
107
107
  - !ruby/object:Gem::Version
108
108
  version: '1.0'
109
109
  type: :runtime
110
110
  prerelease: false
111
111
  version_requirements: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - ~>
113
+ - - "~>"
114
114
  - !ruby/object:Gem::Version
115
115
  version: '1.0'
116
116
  description: Tame Rails' multi-line logging into a single line per request
@@ -146,17 +146,17 @@ require_paths:
146
146
  - lib
147
147
  required_ruby_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - '>='
149
+ - - ">="
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  requirements:
154
- - - '>='
154
+ - - ">="
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  requirements: []
158
158
  rubyforge_project:
159
- rubygems_version: 2.0.14.1
159
+ rubygems_version: 2.6.14
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: Tame Rails' multi-line logging into a single line per request