grape-middleware-lograge 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/grape-middleware-lograge.gemspec +1 -1
- data/lib/lograge/formatters/rails_logger.rb +12 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0749b704c2396f878768bc0b2bc8680a2bc1680b
|
4
|
+
data.tar.gz: b9bdf6e794fd12569c935bb41082d8ace78f44e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b23a158180609730034d9764f504caef4153c578a52e58e039f851ae6866309000ed1bfc8cd83be728f161cc67e82de2e8f26d4e0a2f7d9f08821ec867ef961b
|
7
|
+
data.tar.gz: 1d71a59f35cab62b41ef938891879eeb32d0570793a53823bed4091492c584ee3b86cafcbc71cf0f6b69fa87d9333dc70f640c295712302118cbae324d7b574f
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# A logger for Grape apps
|
2
|
-
[![Code Climate](https://codeclimate.com/github/
|
3
|
-
[![Build Status](https://travis-ci.org/
|
1
|
+
# A logger for Grape apps that uses [Lograge](https://github.com/roidrage/lograge)
|
2
|
+
[![Code Climate](https://codeclimate.com/github/tchak/grape-middleware-lograge/badges/gpa.svg)](https://codeclimate.com/github/tchak/grape-middleware-lograge) [![Gem Version](https://badge.fury.io/rb/grape-middleware-lograge.svg)](http://badge.fury.io/rb/grape-middleware-lograge)
|
3
|
+
[![Build Status](https://travis-ci.org/tchak/grape-middleware-lograge.svg)](https://travis-ci.org/tchak/grape-middleware-lograge)
|
4
4
|
|
5
5
|
Logs:
|
6
6
|
* Request path
|
@@ -17,7 +17,7 @@ Add this line to your application's Gemfile:
|
|
17
17
|
|
18
18
|
```ruby
|
19
19
|
gem 'grape', '>= 0.14.0'
|
20
|
-
gem 'grape-middleware-
|
20
|
+
gem 'grape-middleware-lograge'
|
21
21
|
```
|
22
22
|
|
23
23
|
## Usage
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'grape-middleware-lograge'
|
5
|
-
spec.version = '1.
|
5
|
+
spec.version = '1.1.0'
|
6
6
|
spec.platform = Gem::Platform::RUBY
|
7
7
|
spec.authors = ['Ryan Buckley', 'Paul Chavard']
|
8
8
|
spec.email = ['arebuckley@gmail.com', 'paul+github@chavard.net']
|
@@ -17,21 +17,29 @@ module Lograge
|
|
17
17
|
|
18
18
|
lines = []
|
19
19
|
|
20
|
+
lines << started_request_message(data)
|
20
21
|
lines << "Processing by #{data[:controller]}##{data[:action]} as #{format}"
|
21
22
|
lines << " Parameters: #{params.inspect}" unless params.empty?
|
22
23
|
|
23
24
|
lines
|
24
25
|
end
|
25
26
|
|
27
|
+
def started_request_message(data)
|
28
|
+
'Started %s "%s" for %s at %s' % [
|
29
|
+
data[:method],
|
30
|
+
data[:path],
|
31
|
+
data[:remote_ip],
|
32
|
+
Time.now.to_default_s ]
|
33
|
+
end
|
34
|
+
|
26
35
|
def completed(data)
|
27
36
|
status = data[:status]
|
28
|
-
|
29
|
-
puts ActionDispatch::ExceptionWrapper.rescue_responses
|
37
|
+
duration = data[:duration].round
|
30
38
|
|
31
39
|
if data[:error]
|
32
|
-
"
|
40
|
+
"Error #{status} #{data[:error]} after #{duration}ms"
|
33
41
|
else
|
34
|
-
"Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in #{
|
42
|
+
"Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in #{duration}ms"
|
35
43
|
end
|
36
44
|
end
|
37
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-middleware-lograge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Buckley
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-12-
|
12
|
+
date: 2015-12-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: grape
|