rails-graylogger 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42cf591e1b56d39e146aa353a2ed0f3bbb0bd93e
4
- data.tar.gz: 9a7779e5a53422ea3e6e6fc946b9c58c8df3490c
3
+ metadata.gz: 279bc568e2418b58a0f4f698710667247713aecf
4
+ data.tar.gz: 91eccafa793d098055aa297c85ff5ceccfb5a69e
5
5
  SHA512:
6
- metadata.gz: 9fc47c8907de6a7d46b567d191936d627790d91125f408d84b8ccca9a64605c0f5cd5623fa86cee00fef17c5330aedd7740d5a92d9c241f7379f4f6d91b21977
7
- data.tar.gz: 88b6c0dadbe9e8f81de79fbb6a170c063f9114dd063c9733aa8a4a1cda232655fffaea5ef1bef20e8b5de998d7f78c876402646f242599bc4e4e4ae0f4fe7f60
6
+ metadata.gz: 2379f5d90792bdb95f54e42e62c9df8c765e18dd686dbb09b41c9009c6a3854efabc67f4699ce7f92d17623fcfe4a2dbc59b892ec100a68b354ef141e5f3e378
7
+ data.tar.gz: a3957f935b11597cd739cf821192a2a0551a9c92cc1269093c472e681e01a54be485546e972f245c95334b9094668a94ee87c5e340e15ecfc3fe199cdbc7fe0a
data/.gitignore CHANGED
@@ -3,3 +3,4 @@
3
3
  pkg
4
4
  .yardoc
5
5
  test.log
6
+ /Gemfile.lock
@@ -40,7 +40,7 @@ module RailsGraylogger
40
40
  end
41
41
 
42
42
  def process_extra_fields(payload)
43
- process_exception_data(payload.delete(:exception)) if payload[:exception]
43
+ process_exception_data(payload.delete(:exception))
44
44
 
45
45
  payload.each do |key, value|
46
46
  @extra_fields["_#{key}"] = formatted_value(value) if valid_key?(key)
@@ -62,13 +62,17 @@ module RailsGraylogger
62
62
  end
63
63
 
64
64
  def level_from_status(status)
65
- status < 400 ? GELF::Levels::INFO : GELF::Levels::ERROR
65
+ if status.is_a?(Numeric) && status < 400
66
+ GELF::Levels::INFO
67
+ else
68
+ GELF::Levels::ERROR
69
+ end
66
70
  end
67
71
 
68
72
  def process_exception_data(exception)
69
- exception.each do |key, value|
70
- @extra_fields["_exception_#{key}"] = value.to_s if valid_key?(key)
71
- end
73
+ return unless exception.is_a?(Array)
74
+ @extra_fields["_exception_class"] = exception.first.to_s
75
+ @extra_fields["_exception_message"] = exception.last.to_s
72
76
  end
73
77
  end
74
78
  end
@@ -1,3 +1,3 @@
1
1
  module RailsGraylogger
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -20,5 +20,11 @@ describe RailsGraylogger::Message do
20
20
  @msg.process_extra_fields({ test: { foo: "bar" } })
21
21
  expect(@msg.extra_fields).to eq({ "_test" => "{:foo=>\"bar\"}" })
22
22
  end
23
+
24
+ it "should process the exception data" do
25
+ exception = [ RuntimeError, "test" ]
26
+ @msg.process_extra_fields({ exception: exception })
27
+ expect(@msg.extra_fields).to eq({ "_exception_class" => "RuntimeError", "_exception_message" => "test" })
28
+ end
23
29
  end
24
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-graylogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tuomas Silen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-11 00:00:00.000000000 Z
11
+ date: 2015-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gelf
@@ -89,7 +89,6 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
91
  - Gemfile
92
- - Gemfile.lock
93
92
  - README.md
94
93
  - Rakefile
95
94
  - lib/rails-graylogger.rb
data/Gemfile.lock DELETED
@@ -1,48 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rails-graylogger (0.1.0)
5
- activesupport (~> 4)
6
- gelf (~> 1.4.0)
7
- request_store (~> 1.0)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- activesupport (4.2.0)
13
- i18n (~> 0.7)
14
- json (~> 1.7, >= 1.7.7)
15
- minitest (~> 5.1)
16
- thread_safe (~> 0.3, >= 0.3.4)
17
- tzinfo (~> 1.1)
18
- diff-lcs (1.2.5)
19
- gelf (1.4.0)
20
- json
21
- i18n (0.7.0)
22
- json (1.8.2)
23
- minitest (5.5.1)
24
- rake (10.4.2)
25
- request_store (1.1.0)
26
- rspec (3.1.0)
27
- rspec-core (~> 3.1.0)
28
- rspec-expectations (~> 3.1.0)
29
- rspec-mocks (~> 3.1.0)
30
- rspec-core (3.1.7)
31
- rspec-support (~> 3.1.0)
32
- rspec-expectations (3.1.2)
33
- diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.1.0)
35
- rspec-mocks (3.1.3)
36
- rspec-support (~> 3.1.0)
37
- rspec-support (3.1.2)
38
- thread_safe (0.3.4)
39
- tzinfo (1.2.2)
40
- thread_safe (~> 0.1)
41
-
42
- PLATFORMS
43
- ruby
44
-
45
- DEPENDENCIES
46
- rails-graylogger!
47
- rake
48
- rspec (~> 3)