logjam_agent 0.38.5 → 0.39.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a24358f9899f5d51901c6f1e26abb546cdbe21b04e961ce2a76d213cd1a9d23
4
- data.tar.gz: 8ae4ce5d3b81edb69876408eb823b651841de5da64dfaf3a2288aa7eab42d503
3
+ metadata.gz: f186ba84a9bc5d93776c0d24b140736439fbc0f29eebe2afbeb9401c22eb0987
4
+ data.tar.gz: 7ef52541666f638caa3ffd2798f2da95128f720b9df27c8acf6a37ade5666c08
5
5
  SHA512:
6
- metadata.gz: d532f42b3b39e26448bab7c758076b003de095d2e42c4bf26c383b10936aa7c156b2fd0dd10049850eaeb5036abececfb50c0a6b1423747790f6a7943510394e
7
- data.tar.gz: d0fb5cc2eef5c93477a6a41dda442186745a646f16653e21b949be49102d9d515e7216fe901bc268c0f0be8de56b68918a80fbcc9359daefa847e15e2aa63834
6
+ metadata.gz: a3a424872649058f48a09babd30da5abac2e013db6afe50fd9284bb51e313fe6ab9d313c47f7aee40e097c64b297d533d209d3f118273fc1980e2f4e6f08f138
7
+ data.tar.gz: 4003a735b587bd1e6a69cd2f6c671ce86f70c609269dd273fb8859ea0a9795cf5264421d088b842b5d357f50c090360d2530ae092cf05a639c17e808465ae6aa
@@ -13,13 +13,16 @@ class LogjamAgent::ConsoleFormatter < Logger::Formatter
13
13
  end
14
14
  end
15
15
 
16
- class ActiveSupport::Logger
17
- class << self
18
- alias_method :original_broadcast, :broadcast
19
- def broadcast(logger)
20
- logger.formatter = LogjamAgent::ConsoleFormatter.new
21
- logger.formatter.extend(ActiveSupport::TaggedLogging::Formatter)
22
- original_broadcast(logger)
16
+ if Gem::Version.new(ActiveSupport::VERSION::STRING) < Gem::Version.new("7.1.0")
17
+
18
+ class ActiveSupport::Logger
19
+ class << self
20
+ alias_method :original_broadcast, :broadcast
21
+ def broadcast(logger)
22
+ logger.formatter = LogjamAgent::ConsoleFormatter.new
23
+ logger.formatter.extend(ActiveSupport::TaggedLogging::Formatter)
24
+ original_broadcast(logger)
25
+ end
23
26
  end
24
27
  end
25
28
  end
@@ -12,6 +12,7 @@ module LogjamAgent
12
12
  @asset_prefix = Rails.application.config.assets.prefix rescue "---"
13
13
  @ignore_asset_requests = LogjamAgent.ignore_asset_requests
14
14
  @ignored_request_urls = LogjamAgent.ignored_request_urls
15
+ @use_to_default_s = Gem::Version.new(ActiveSupport::VERSION::STRING) < Gem::Version.new("7.1.0")
15
16
  end
16
17
 
17
18
  def call(env)
@@ -123,7 +124,8 @@ module LogjamAgent
123
124
  logjam_fields.merge!(extract_request_info(request))
124
125
 
125
126
  LogjamAgent.logjam_only do
126
- info "Started #{request.request_method} \"#{path}\" for #{ip} at #{start_time.to_default_s}" unless logjam_request.ignored?(:asset)
127
+ started_at_str = @use_to_default_s ? start_time.to_default_s : start_time.to_s
128
+ info "Started #{request.request_method} \"#{path}\" for #{ip} at #{started_at_str}" unless logjam_request.ignored?(:asset)
127
129
  end
128
130
  if spoofed
129
131
  error spoofed
@@ -10,6 +10,7 @@ module ActionController #:nodoc:
10
10
  params = payload[:params].except(*INTERNAL_PARAMS)
11
11
  format = payload[:format]
12
12
  format = format.to_s.upcase if format.is_a?(Symbol)
13
+ format = "*/*" if format.nil?
13
14
 
14
15
  controller = payload[:controller]
15
16
  action = payload[:action]
@@ -33,6 +33,19 @@ module LogjamAgent
33
33
  )
34
34
  LogjamAgent.logger = logger
35
35
  end
36
+
37
+ if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new("7.1.0")
38
+ unless Rails.logger.is_a?(ActiveSupport::BroadcastLogger)
39
+ broadcast_logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
40
+ broadcast_logger.formatter = Rails.logger.formatter
41
+ Rails.logger = broadcast_logger
42
+ LogjamAgent.logger = logger
43
+ end
44
+
45
+ unless app.config.consider_all_requests_local
46
+ Rails.error.logger = Rails.logger
47
+ end
48
+ end
36
49
  end
37
50
 
38
51
  initializer "logjam_agent", :after => "time_bandits" do |app|
@@ -127,11 +140,21 @@ module LogjamAgent
127
140
  trace = wrapper.application_trace
128
141
  trace = wrapper.framework_trace if trace.empty?
129
142
 
130
- ActiveSupport::Deprecation.silence do
131
- parts = [ "#{exception.class} (#{exception.message})" ]
132
- parts.concat exception.annoted_source_code if exception.respond_to?(:annoted_source_code)
133
- parts.concat trace
134
- logger.fatal parts.join("\n ")
143
+ if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new("7.1.0")
144
+ Rails.application.deprecators.silence do
145
+ parts = [ "#{exception.class} (#{exception.message})" ]
146
+ parts.concat exception.annoted_source_code if exception.respond_to?(:annoted_source_code)
147
+ parts.concat trace
148
+ logger.fatal parts.join("\n ")
149
+ end
150
+ else
151
+ ActiveSupport::Deprecation.silence do
152
+ parts = [ "#{exception.class} (#{exception.message})" ]
153
+ parts.concat exception.annoted_source_code if exception.respond_to?(:annoted_source_code)
154
+ parts.concat trace
155
+ logger.fatal parts.join("\n ")
156
+ end
157
+
135
158
  end
136
159
  end
137
160
  end
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.38.5"
2
+ VERSION = "0.39.1"
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.38.5
4
+ version: 0.39.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-26 00:00:00.000000000 Z
11
+ date: 2024-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  requirements: []
131
- rubygems_version: 3.4.10
131
+ rubygems_version: 3.5.11
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Logjam client library to be used with logjam