resurfaceio-logger 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/resurfaceio/http_logger_for_rack.rb +3 -1
- data/lib/resurfaceio/http_logger_for_rails.rb +3 -1
- data/lib/resurfaceio/timer.rb +14 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96d9dcd75c1689a944d72d80ed12692efbdc75b8c10b391bece364c26090efc1
|
4
|
+
data.tar.gz: 6851901ff3dba16d290c479cd8262f6ff3789997089bb213ead746ccb74ebb93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf5eb2c3775d016416f6e55a35a1422f4ae33d89887ffe7bf69ac280e4f569d98eed2aacb4715efcf20af4e07527726f262ad268131605174d038231a152ce3c
|
7
|
+
data.tar.gz: 715e09307d21578168425a94ef905a00bcf5497153e3902d2a3a5b0f8e058caa8d14a158ea571b0fbc81c04dd1a6c2416a4342c892a941eaf0c26fbcdb0972a1
|
@@ -4,6 +4,7 @@
|
|
4
4
|
require 'rack'
|
5
5
|
require 'resurfaceio/http_logger'
|
6
6
|
require 'resurfaceio/http_message'
|
7
|
+
require 'resurfaceio/timer'
|
7
8
|
|
8
9
|
class HttpLoggerForRack # http://rack.rubyforge.org/doc/SPEC.html
|
9
10
|
|
@@ -17,12 +18,13 @@ class HttpLoggerForRack # http://rack.rubyforge.org/doc/SPEC.html
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def call(env)
|
21
|
+
timer = Timer.new
|
20
22
|
status, headers, body = @app.call(env)
|
21
23
|
if @logger.enabled? && (status < 300 || status == 302)
|
22
24
|
response = Rack::Response.new(body, status, headers)
|
23
25
|
if HttpLogger::string_content_type?(response.content_type)
|
24
26
|
request = Rack::Request.new(env)
|
25
|
-
HttpMessage.send(logger, request, response
|
27
|
+
HttpMessage.send(logger, request, response, nil, nil, nil, timer.millis)
|
26
28
|
end
|
27
29
|
end
|
28
30
|
[status, headers, body]
|
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'resurfaceio/http_logger'
|
5
5
|
require 'resurfaceio/http_message'
|
6
|
+
require 'resurfaceio/timer'
|
6
7
|
|
7
8
|
class HttpLoggerForRails
|
8
9
|
|
@@ -15,13 +16,14 @@ class HttpLoggerForRails
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def around(controller)
|
19
|
+
timer = Timer.new
|
18
20
|
yield
|
19
21
|
if @logger.enabled?
|
20
22
|
request = controller.request
|
21
23
|
response = controller.response
|
22
24
|
status = response.status
|
23
25
|
if (status < 300 || status == 302) && HttpLogger::string_content_type?(response.content_type)
|
24
|
-
HttpMessage.send(logger, request, response
|
26
|
+
HttpMessage.send(logger, request, response, nil, nil, nil, timer.millis)
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# © 2016-2020 Resurface Labs Inc.
|
3
|
+
|
4
|
+
class Timer
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@started = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
|
8
|
+
end
|
9
|
+
|
10
|
+
def millis
|
11
|
+
(Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond) - @started).to_s
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resurfaceio-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RobDickinson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.9'
|
69
69
|
description: Library for usage logging
|
70
|
-
email:
|
70
|
+
email:
|
71
71
|
executables: []
|
72
72
|
extensions: []
|
73
73
|
extra_rdoc_files: []
|
@@ -82,12 +82,13 @@ files:
|
|
82
82
|
- lib/resurfaceio/http_response_impl.rb
|
83
83
|
- lib/resurfaceio/http_rule.rb
|
84
84
|
- lib/resurfaceio/http_rules.rb
|
85
|
+
- lib/resurfaceio/timer.rb
|
85
86
|
- lib/resurfaceio/usage_loggers.rb
|
86
87
|
homepage: https://github.com/resurfaceio/logger-ruby
|
87
88
|
licenses:
|
88
89
|
- Apache-2.0
|
89
90
|
metadata: {}
|
90
|
-
post_install_message:
|
91
|
+
post_install_message:
|
91
92
|
rdoc_options: []
|
92
93
|
require_paths:
|
93
94
|
- lib
|
@@ -103,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
104
|
version: '0'
|
104
105
|
requirements: []
|
105
106
|
rubygems_version: 3.0.3
|
106
|
-
signing_key:
|
107
|
+
signing_key:
|
107
108
|
specification_version: 4
|
108
109
|
summary: Library for usage logging
|
109
110
|
test_files: []
|