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 +4 -4
- data/lib/logjam_agent/buffered_logger.rb +1 -2
- data/lib/logjam_agent/rack/logger.rb +8 -5
- data/lib/logjam_agent/sinatra.rb +1 -1
- data/lib/logjam_agent/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f440bd17eaed288b652b4537a82ebcedaa6aae2c213e99cfce4c9a78259c8e1a
|
4
|
+
data.tar.gz: 4c437031ed233e9b836714742f37e23a6b8b2bcc81155776d8ce31b17040cdd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
38
|
-
if
|
38
|
+
wait_time = start_time - http_start_time
|
39
|
+
if wait_time > 0
|
39
40
|
start_time = http_start_time
|
40
41
|
else
|
41
|
-
|
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
|
-
|
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
|
|
data/lib/logjam_agent/sinatra.rb
CHANGED
@@ -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 =
|
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
|
data/lib/logjam_agent/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2022-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|