logjam_agent 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -121,22 +121,65 @@ require 'action_controller/log_subscriber'
121
121
  module ActionController #:nodoc:
122
122
 
123
123
  class LogSubscriber
124
- def start_processing(event)
125
- payload = event.payload
126
- params = payload[:params].except(*INTERNAL_PARAMS)
127
- format = payload[:format]
128
- format = format.to_s.upcase if format.is_a?(Symbol)
129
-
130
- controller = payload[:controller]
131
- action = payload[:action]
132
- full_name = "#{controller}##{action}"
133
- action_name = LogjamAgent.action_name_proc.call(full_name)
134
-
135
- # puts "setting logjam action to #{action_name}"
136
- Rails.logger.request.fields[:action] = action_name
137
-
138
- info "Processing by #{full_name} as #{format}"
139
- info " Parameters: #{params.inspect}" unless params.empty?
124
+ if Rails::VERSION::STRING =~ /^3.0/
125
+ def start_processing(event)
126
+ payload = event.payload
127
+ params = payload[:params].except(*INTERNAL_PARAMS)
128
+
129
+ controller = payload[:controller]
130
+ action = payload[:action]
131
+ full_name = "#{controller}##{action}"
132
+ action_name = LogjamAgent.action_name_proc.call(full_name)
133
+
134
+ # puts "setting logjam action to #{action_name}"
135
+ Rails.logger.request.fields[:action] = action_name
136
+
137
+ info " Processing by #{full_name} as #{payload[:formats].first.to_s.upcase}"
138
+ info " Parameters: #{params.inspect}" unless params.empty?
139
+ end
140
+
141
+ elsif Rails::VERSION::STRING =~ /^3.1/
142
+
143
+ def start_processing(event)
144
+ payload = event.payload
145
+ params = payload[:params].except(*INTERNAL_PARAMS)
146
+ format = payload[:format]
147
+ format = format.to_s.upcase if format.is_a?(Symbol)
148
+
149
+ controller = payload[:controller]
150
+ action = payload[:action]
151
+ full_name = "#{controller}##{action}"
152
+ action_name = LogjamAgent.action_name_proc.call(full_name)
153
+
154
+ # puts "setting logjam action to #{action_name}"
155
+ Rails.logger.request.fields[:action] = action_name
156
+
157
+ info " Processing by #{full_name} as #{format}"
158
+ info " Parameters: #{params.inspect}" unless params.empty?
159
+ end
160
+
161
+ elsif Rails::VERSION::STRING =~ /^3.2/
162
+
163
+ def start_processing(event)
164
+ payload = event.payload
165
+ params = payload[:params].except(*INTERNAL_PARAMS)
166
+ format = payload[:format]
167
+ format = format.to_s.upcase if format.is_a?(Symbol)
168
+
169
+ controller = payload[:controller]
170
+ action = payload[:action]
171
+ full_name = "#{controller}##{action}"
172
+ action_name = LogjamAgent.action_name_proc.call(full_name)
173
+
174
+ # puts "setting logjam action to #{action_name}"
175
+ Rails.logger.request.fields[:action] = action_name
176
+
177
+ info "Processing by #{full_name} as #{format}"
178
+ info " Parameters: #{params.inspect}" unless params.empty?
179
+ end
180
+
181
+ else
182
+ raise "loggjam_agent ActionController monkey patch is not compatible with your Rails version"
140
183
  end
141
184
  end
142
185
 
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.6.7"
2
+ VERSION = "0.6.8"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logjam_agent
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 7
10
- version: 0.6.7
9
+ - 8
10
+ version: 0.6.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Stefan Kaes
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-05-13 00:00:00 Z
18
+ date: 2013-05-17 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake