logjam_agent 0.34.0 → 0.34.3

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: f3cc7aaf7edaf4f4a2ab8b0cbb9922449fcadf2ca515add756d9052ca30f104a
4
- data.tar.gz: 9c648bc52c752ebd7a394b9b74f5a2d2ff1f92aff23393a37dcd714b324339ea
3
+ metadata.gz: f440bd17eaed288b652b4537a82ebcedaa6aae2c213e99cfce4c9a78259c8e1a
4
+ data.tar.gz: 4c437031ed233e9b836714742f37e23a6b8b2bcc81155776d8ce31b17040cdd5
5
5
  SHA512:
6
- metadata.gz: 29350bbdb8502910e181ee155a369d0a16793a916430b4150aee46e956e931aac3ba697d9066e0bc14c6826918b1085022b492e13d283f3f49b19cd10a2a2c22
7
- data.tar.gz: 1798f1ce01b48e947fd4b54455c8f446551e474b93120fed751eefc0ea72584e68b610d7d2cbe4fa7f46b4f6d97a9a82d50049339cb477b5dfad62b9a57c005f
6
+ metadata.gz: d614ce5608d99b1735766d0d99a0b99d64a78bd75146891036d0063b11728ef8d92b0fcbb3de1bd95acd92999969fb0d4afcc06c9a439e986c279848eb899ee6
7
+ data.tar.gz: 4f63d8cef062c3350e6fbbc26a997300fb5928430bf335a3d3efb959e97fd6ca7e14e13bd1ca15a4d58575485104005416b042b2b4546d6a1c017218b8789efa
@@ -62,7 +62,7 @@ module LogjamAgent
62
62
  time = Time.now
63
63
  if log_to_log_device
64
64
  formatted_message = formatter.call(format_severity(severity), time, progname, message)
65
- @logdev.write(formatted_message)
65
+ @logdev.write(formatted_message) if @logdev
66
66
  end
67
67
  request.add_line(severity, time, message) if request
68
68
  message
@@ -70,7 +70,6 @@ module LogjamAgent
70
70
 
71
71
  def logdev=(log_device)
72
72
  raise "cannot connect logger to new log device" unless log_device.respond_to?(:write)
73
- raise "cannot set log device" unless defined?(@logdev)
74
73
  @logdev = log_device
75
74
  end
76
75
 
@@ -32,21 +32,24 @@ module LogjamAgent
32
32
 
33
33
  def call_app(request, env)
34
34
  start_time = Time.now
35
- wait_time_ms = 0.0
35
+ start_clock = Process.clock_gettime(Process::CLOCK_MONOTONIC)
36
+ wait_time = 0.0
36
37
  if http_start_time = extract_http_start_time(env)
37
- wait_time_ms = (start_time - http_start_time) * 1000
38
- if wait_time_ms > 0
38
+ wait_time = start_time - http_start_time
39
+ if wait_time > 0
39
40
  start_time = http_start_time
40
41
  else
41
- wait_time_ms = 0.0
42
+ wait_time = 0.0
42
43
  end
43
44
  end
45
+ wait_time_ms = wait_time * 1000
44
46
  before_dispatch(request, env, start_time, wait_time_ms)
45
47
  result = @app.call(env)
46
48
  rescue ActionDispatch::RemoteIp::IpSpoofAttackError
47
49
  result = [403, {}, ['Forbidden']]
48
50
  ensure
49
- run_time_ms = (Time.now - start_time) * 1000
51
+ end_clock = Process.clock_gettime(Process::CLOCK_MONOTONIC)
52
+ run_time_ms = (end_clock - start_clock + wait_time) * 1000
50
53
  after_dispatch(env, result, run_time_ms, wait_time_ms)
51
54
  end
52
55
 
@@ -38,7 +38,7 @@ module LogjamAgent
38
38
  LogjamAgent.log_device_log_level = logger.level
39
39
  LogjamAgent.log_device_log_level = ::Logger::ERROR unless %i[test development].include?(settings.environment.to_sym)
40
40
 
41
- logger.formatter = LogjamAgent::SyslogLikeFormatter.new
41
+ logger.formatter = settings.respond_to?(:logformatter) ? settings.logformatter : Logger::Formatter.new
42
42
  logger = ActiveSupport::TaggedLogging.new(logger)
43
43
  LogjamAgent.logger = logger
44
44
  ActiveSupport::LogSubscriber.logger = logger
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.34.0"
2
+ VERSION = "0.34.3"
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.34.0
4
+ version: 0.34.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-23 00:00:00.000000000 Z
11
+ date: 2022-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake