yell-adapters-gelf 0.13.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -59,22 +59,22 @@ module Yell #:nodoc:
59
59
  end
60
60
 
61
61
  write do |event|
62
+ message = format({
63
+ 'version' => '1.0',
64
+
65
+ 'facility' => facility,
66
+ 'level' => Severities[event.level],
67
+ 'timestamp' => event.time.to_f,
68
+ 'host' => event.hostname,
69
+
70
+ 'file' => event.file,
71
+ 'line' => event.line,
72
+ '_method' => event.method,
73
+ '_pid' => event.pid
74
+ }, *event.messages )
75
+
62
76
  # https://github.com/Graylog2/graylog2-docs/wiki/GELF
63
- _datagrams = datagrams(
64
- {
65
- 'version' => '1.0',
66
-
67
- 'facility' => facility,
68
- 'level' => Severities[event.level],
69
- 'timestamp' => event.time.to_f,
70
- 'host' => event.hostname,
71
-
72
- 'file' => event.file,
73
- 'line' => event.line,
74
- '_method' => event.method,
75
- '_pid' => event.pid
76
- }.merge( format(event.message) ).merge( format(event.options) )
77
- )
77
+ _datagrams = datagrams( message )
78
78
 
79
79
  sender.send( *_datagrams )
80
80
  end
@@ -136,7 +136,17 @@ module Yell #:nodoc:
136
136
  _datagrams
137
137
  end
138
138
 
139
- def format( message )
139
+ def uid
140
+ @uid += 1
141
+ end
142
+
143
+ def format( *messages )
144
+ messages.inject(Hash.new) do |result, m|
145
+ result.merge to_message(m)
146
+ end
147
+ end
148
+
149
+ def to_message( message )
140
150
  case message
141
151
  when Hash
142
152
  message
@@ -148,10 +158,6 @@ module Yell #:nodoc:
148
158
  end
149
159
  end
150
160
 
151
- def uid
152
- @uid += 1
153
- end
154
-
155
161
  end
156
162
 
157
163
  register( :gelf, Yell::Adapters::Gelf )
@@ -136,7 +136,7 @@ describe Yell::Adapters::Gelf do
136
136
  end
137
137
 
138
138
  it "should receive :short_message" do
139
- mock.proxy( adapter ).datagrams( hash_including('short_message' => event.message) )
139
+ mock.proxy( adapter ).datagrams( hash_including('short_message' => event.messages.first) )
140
140
  end
141
141
 
142
142
  it "should receive :timestamp" do
@@ -1,10 +1,8 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- $:.push File.expand_path("../lib", __FILE__)
4
-
5
3
  Gem::Specification.new do |s|
6
4
  s.name = "yell-adapters-gelf"
7
- s.version = "0.13.4"
5
+ s.version = "1.1.0"
8
6
  s.authors = ["Rudolf Schmidt"]
9
7
 
10
8
  s.homepage = "http://rubygems.org/gems/yell"
@@ -19,7 +17,7 @@ Gem::Specification.new do |s|
19
17
 
20
18
  s.require_paths = ["lib"]
21
19
 
22
- s.add_runtime_dependency "yell", ">= 0.13.4"
20
+ s.add_runtime_dependency "yell", "~> 1.1"
23
21
  s.add_runtime_dependency "json"
24
22
  end
25
23
 
metadata CHANGED
@@ -1,88 +1,90 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: yell-adapters-gelf
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
4
5
  prerelease:
5
- version: 0.13.4
6
6
  platform: ruby
7
- authors:
8
- - Rudolf Schmidt
7
+ authors:
8
+ - Rudolf Schmidt
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-09-14 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: yell
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 0.13.4
24
- type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: json
28
- prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "0"
35
- type: :runtime
36
- version_requirements: *id002
12
+ date: 2012-10-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: yell
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.1'
30
+ - !ruby/object:Gem::Dependency
31
+ name: json
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
37
46
  description: Graylog2 adapter for Yell
38
47
  email:
39
48
  executables: []
40
-
41
49
  extensions: []
42
-
43
50
  extra_rdoc_files: []
44
-
45
- files:
46
- - .gitignore
47
- - .travis.yml
48
- - Gemfile
49
- - LICENSE.txt
50
- - README.md
51
- - Rakefile
52
- - lib/yell-adapters-gelf.rb
53
- - lib/yell/adapters/gelf.rb
54
- - lib/yell/adapters/gelf/version.rb
55
- - spec/spec_helper.rb
56
- - spec/yell/adapters/gelf_spec.rb
57
- - yell-adapters-gelf.gemspec
51
+ files:
52
+ - .gitignore
53
+ - .travis.yml
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - lib/yell-adapters-gelf.rb
59
+ - lib/yell/adapters/gelf.rb
60
+ - spec/spec_helper.rb
61
+ - spec/yell/adapters/gelf_spec.rb
62
+ - yell-adapters-gelf.gemspec
58
63
  homepage: http://rubygems.org/gems/yell
59
64
  licenses: []
60
-
61
65
  post_install_message:
62
66
  rdoc_options: []
63
-
64
- require_paths:
65
- - lib
66
- required_ruby_version: !ruby/object:Gem::Requirement
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
67
70
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- version: "0"
72
- required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
76
  none: false
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: "0"
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
78
81
  requirements: []
79
-
80
82
  rubyforge_project: yell
81
- rubygems_version: 1.8.15
83
+ rubygems_version: 1.8.24
82
84
  signing_key:
83
85
  specification_version: 3
84
86
  summary: Yell - Your Extensible Logging Library
85
- test_files:
86
- - spec/spec_helper.rb
87
- - spec/yell/adapters/gelf_spec.rb
87
+ test_files:
88
+ - spec/spec_helper.rb
89
+ - spec/yell/adapters/gelf_spec.rb
88
90
  has_rdoc:
@@ -1,11 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Yell #:nodoc:
4
- module Adapters #:nodoc:
5
- class Gelf
6
- VERSION = "0.13.0"
7
-
8
- end
9
- end
10
- end
11
-