gelf 0.9.1 → 0.9.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.
- data/Manifest +1 -1
- data/Rakefile +1 -1
- data/gelf.gemspec +3 -3
- data/lib/gelf.rb +14 -2
- metadata +5 -5
data/Manifest
CHANGED
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('gelf', '0.9.
|
5
|
+
Echoe.new('gelf', '0.9.2') do |p|
|
6
6
|
p.description = "Library to send Graylog2 Extended Log Format (GELF) messages"
|
7
7
|
p.url = "http://www.graylog2.org/"
|
8
8
|
p.author = "Lennart Koopmann"
|
data/gelf.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{gelf}
|
5
|
-
s.version = "0.9.
|
5
|
+
s.version = "0.9.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Lennart Koopmann"]
|
9
|
-
s.date = %q{2010-10-
|
9
|
+
s.date = %q{2010-10-18}
|
10
10
|
s.description = %q{Library to send Graylog2 Extended Log Format (GELF) messages}
|
11
11
|
s.email = %q{lennart@socketfeed.com}
|
12
12
|
s.extra_rdoc_files = ["lib/gelf.rb"]
|
13
|
-
s.files = ["Rakefile", "lib/gelf.rb", "
|
13
|
+
s.files = ["Manifest", "Rakefile", "lib/gelf.rb", "gelf.gemspec"]
|
14
14
|
s.homepage = %q{http://www.graylog2.org/}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Gelf"]
|
16
16
|
s.require_paths = ["lib"]
|
data/lib/gelf.rb
CHANGED
@@ -8,13 +8,19 @@ class Gelf
|
|
8
8
|
|
9
9
|
MAX_CHUNK_SIZE = 8154
|
10
10
|
|
11
|
-
attr_accessor :short_message, :full_message, :level, :host, :
|
11
|
+
attr_accessor :short_message, :full_message, :level, :host, :line, :file
|
12
|
+
|
13
|
+
@@additional = []
|
12
14
|
|
13
15
|
def initialize hostname, port
|
14
16
|
@hostname = hostname
|
15
17
|
@port = port
|
16
18
|
end
|
17
19
|
|
20
|
+
def add_additional key, value
|
21
|
+
@@additional << { :key => key, :value => value }
|
22
|
+
end
|
23
|
+
|
18
24
|
def send
|
19
25
|
# Check if all required parameters are set.
|
20
26
|
if self.short_message == nil or self.host == nil
|
@@ -26,11 +32,17 @@ class Gelf
|
|
26
32
|
"full_message" => self.full_message,
|
27
33
|
"level" => self.level,
|
28
34
|
"host" => self.host,
|
29
|
-
"type" => self.type,
|
30
35
|
"line" => self.line,
|
31
36
|
"file" => self.file
|
32
37
|
}
|
33
38
|
|
39
|
+
# Add additional fields if there are some.
|
40
|
+
if @@additional.count > 0
|
41
|
+
@@additional.each do |additional|
|
42
|
+
data[additional[:key].delete(' ')] = additional[:value]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
34
46
|
# Convert to JSON and deflate (ZLIB)
|
35
47
|
data = Zlib::Deflate.deflate(data.to_json)
|
36
48
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gelf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 2
|
10
|
+
version: 0.9.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lennart Koopmann
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-18 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -28,9 +28,9 @@ extensions: []
|
|
28
28
|
extra_rdoc_files:
|
29
29
|
- lib/gelf.rb
|
30
30
|
files:
|
31
|
+
- Manifest
|
31
32
|
- Rakefile
|
32
33
|
- lib/gelf.rb
|
33
|
-
- Manifest
|
34
34
|
- gelf.gemspec
|
35
35
|
has_rdoc: true
|
36
36
|
homepage: http://www.graylog2.org/
|