logjam_agent 0.20.0 → 0.21.0

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
  SHA1:
3
- metadata.gz: ffbc348a41b699fbc21851d6aaf0aa3c8c7146b4
4
- data.tar.gz: d3ea3f038cc01a711e971b9c2a003566bd29fae0
3
+ metadata.gz: d02ede9be339e8cb390405fa13e3ea082029de86
4
+ data.tar.gz: 2c6a677da91a71d150e2e4148dd2ad3f7597a4c2
5
5
  SHA512:
6
- metadata.gz: 016587a88a5cb0a035128ab5d1546338136bd6104bafe663cf758edd6fe48df79bc7a26f8b301a3a67fada38e63f929aa12529047a53e4d4a41e6487d8627df2
7
- data.tar.gz: 2785a7e0288269b408e4774432dc33d92197574bb360f6e3712c497dca761f807526dcab6fb628ed7ed070b5f12530bdf1b52926b1f83727182c0a10e0c7ffa5
6
+ metadata.gz: ae77ad1d26aaea1f8e2cbd4e96f27ea87cfea574988a93481c9a03b560a0fa8b110fc12ebeadf307cd37f34c3cff44ddb25b05b47367c8f496068b4f806758db
7
+ data.tar.gz: e95a74079e8ca28e6e5fcc3c04e7a330ecc97718d97cfacb46bd5d037c0d988bef23020665b217dc0f592a1f71a73560ee6f5093651a2d98eb22f89ffc44fef8
@@ -226,7 +226,7 @@ module ActionController #:nodoc:
226
226
  info " Parameters: #{params.inspect}" unless params.empty?
227
227
  end
228
228
 
229
- elsif Rails::VERSION::STRING =~ /\A(3\.2|4\.[012])/
229
+ elsif Rails::VERSION::STRING =~ /\A(3\.2|4\.[012]|5)/
230
230
 
231
231
  # Rails 4.1 uses method_added to automatically subscribe newly
232
232
  # added methods. Since start_processing is already defined, the
@@ -45,8 +45,8 @@ module LogjamAgent
45
45
  LogjamAgent.environment_name = Rails.env
46
46
  LogjamAgent.auto_detect_logged_exceptions
47
47
 
48
- app.config.middleware.swap("TimeBandits::Rack::Logger", "LogjamAgent::Rack::Logger")
49
- app.config.middleware.insert_before("LogjamAgent::Rack::Logger", "LogjamAgent::Middleware")
48
+ app.config.middleware.swap(TimeBandits::Rack::Logger, LogjamAgent::Rack::Logger)
49
+ app.config.middleware.insert_before(LogjamAgent::Rack::Logger, LogjamAgent::Middleware)
50
50
 
51
51
  if defined?(::ActionDispatch::RemoteIp)
52
52
  app.config.middleware.delete ::ActionDispatch::RemoteIp
@@ -78,16 +78,16 @@ module LogjamAgent
78
78
  # patch controller testing to create a logjam request, because middlewares aren't executed
79
79
  if Rails.env.test?
80
80
  ActiveSupport.on_load(:action_controller) do
81
- require 'action_controller/test_case'
82
- module ActionController::TestCase::Behavior
83
- def process_with_logjam(*args)
81
+ module TestWithLogjamStartRequest
82
+ def process(*args)
84
83
  LogjamAgent.start_request
85
- process_without_logjam(*args)
84
+ super
86
85
  ensure
87
86
  LogjamAgent.finish_request
88
87
  end
89
- alias_method_chain :process, :logjam
90
88
  end
89
+ require 'action_controller/test_case'
90
+ ActionController::TestCase::Behavior.prepend TestWithLogjamStartRequest
91
91
  end
92
92
  end
93
93
  end
@@ -107,6 +107,32 @@ module LogjamAgent
107
107
  EVA
108
108
  end
109
109
 
110
+ if Rails::VERSION::STRING >= "5.0"
111
+ # we want backtraces etc. logged as a single string with newlines.
112
+ # TODO: when logging with tags, we might want to have tags and
113
+ # timestamps on disk. Not sure how useful this would be, though.
114
+ ActiveSupport.on_load(:action_controller) do
115
+ ActionDispatch::DebugExceptions.class_eval do
116
+ def log_error(request, wrapper)
117
+ logger = logger(request)
118
+ return unless logger
119
+
120
+ exception = wrapper.exception
121
+
122
+ trace = wrapper.application_trace
123
+ trace = wrapper.framework_trace if trace.empty?
124
+
125
+ ActiveSupport::Deprecation.silence do
126
+ parts = [ "#{exception.class} (#{exception.message})" ]
127
+ parts.concact exception.annoted_source_code if exception.respond_to?(:annoted_source_code)
128
+ parts.concat trace
129
+ logger.fatal parts.join("\n ")
130
+ end
131
+ end
132
+ end
133
+ end
134
+ end
135
+
110
136
  config.after_initialize do
111
137
  if LogjamAgent.ignore_render_events
112
138
  ActiveSupport::Notifications.unsubscribe("render_template.action_view")
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.20.0"
2
+ VERSION = "0.21.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logjam_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake