lograge 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,13 +52,17 @@ module Lograge
52
52
  def extract_request(payload)
53
53
  {
54
54
  :method => payload[:method],
55
- :path => payload[:path],
55
+ :path => extract_path(payload),
56
56
  :format => extract_format(payload),
57
57
  :controller => payload[:params]['controller'],
58
58
  :action => payload[:params]['action']
59
59
  }
60
60
  end
61
61
 
62
+ def extract_path(payload)
63
+ payload[:path].split("?").first
64
+ end
65
+
62
66
  def extract_format(payload)
63
67
  if ::ActionPack::VERSION::MAJOR == 3 && ::ActionPack::VERSION::MINOR == 0
64
68
  payload[:formats].first
@@ -1,3 +1,3 @@
1
1
  module Lograge
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -22,8 +22,8 @@ describe Lograge::RequestLogSubscriber do
22
22
  let(:event) {
23
23
  ActiveSupport::Notifications::Event.new(
24
24
  'process_action.action_controller', Time.now, Time.now, 2, {
25
- status: 200, format: 'application/json', method: 'GET', path: '/home', params: {
26
- 'controller' => 'home', 'action' => 'index'
25
+ status: 200, format: 'application/json', method: 'GET', path: '/home?foo=bar', params: {
26
+ 'controller' => 'home', 'action' => 'index', 'foo' => 'bar'
27
27
  }, db_runtime: 0.02, view_runtime: 0.01
28
28
  }
29
29
  )
@@ -45,6 +45,11 @@ describe Lograge::RequestLogSubscriber do
45
45
  log_output.string.should include('/home')
46
46
  end
47
47
 
48
+ it "should not include the query string in the url" do
49
+ subscriber.process_action(event)
50
+ log_output.string.should_not include('?foo=bar')
51
+ end
52
+
48
53
  it "should start the log line with the HTTP method" do
49
54
  subscriber.process_action(event)
50
55
  log_output.string.starts_with?('method=GET ').should == true
@@ -112,7 +117,7 @@ describe Lograge::RequestLogSubscriber do
112
117
  end
113
118
  end
114
119
 
115
- describe "when processing an action with logstash output" do
120
+ describe "when processing an action with logstash output" do
116
121
  before do
117
122
  require 'logstash-event'
118
123
  Lograge::log_format = :logstash
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lograge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-08 00:00:00.000000000 Z
12
+ date: 2012-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec