gelf 1.0.0 → 1.0.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/CHANGELOG +3 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/gelf.gemspec +4 -4
- data/lib/gelf/notifier.rb +1 -2
- data/test/test_notifier.rb +17 -0
- metadata +4 -4
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/gelf.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gelf}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alexey Palazhchenko", "Lennart Koopmann"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-29}
|
13
13
|
s.description = %q{Suports plain-text, GELF messages and exceptions.}
|
14
14
|
s.email = %q{lennart@socketfeed.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -38,8 +38,8 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.summary = %q{Library to send GELF messages to Graylog2 logging server}
|
39
39
|
s.test_files = [
|
40
40
|
"test/helper.rb",
|
41
|
-
"test/
|
42
|
-
"test/
|
41
|
+
"test/test_deprecations.rb",
|
42
|
+
"test/test_notifier.rb"
|
43
43
|
]
|
44
44
|
|
45
45
|
if s.respond_to? :specification_version then
|
data/lib/gelf/notifier.rb
CHANGED
@@ -107,8 +107,7 @@ module GELF
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def chunk_data(data, msg_id, sequence_number, sequence_count)
|
110
|
-
|
111
|
-
return "\036\017" + msg_id + [sequence_number, sequence_count].pack('nn') + data.map(&:chr).join
|
110
|
+
return "\036\017" + msg_id + [sequence_number, sequence_count, *data].pack('nnC*')
|
112
111
|
end
|
113
112
|
|
114
113
|
def detect_this_host
|
data/test/test_notifier.rb
CHANGED
@@ -126,5 +126,22 @@ class TestNotifier < Test::Unit::TestCase
|
|
126
126
|
@notifier.expects(:notify!).with(instance_of(ArgumentError))
|
127
127
|
assert_nothing_raised { @notifier.notify(:no_short_message => 'too bad') }
|
128
128
|
end
|
129
|
+
|
130
|
+
should "chunk data" do
|
131
|
+
UDPSocket.any_instance.stubs(:send)
|
132
|
+
srand(1) # for stable tests
|
133
|
+
data = (0..3000).map { RANDOM_DATA[rand(RANDOM_DATA.count)] }.join
|
134
|
+
datagrams = @notifier.__send__(:do_notify, {'short_message' => data, 'host' => 'localhost'})
|
135
|
+
assert_equal 2, datagrams.count
|
136
|
+
datagrams.each_index do |i|
|
137
|
+
datagram = datagrams[i]
|
138
|
+
assert datagram[0..1] == "\x1e\x0f"
|
139
|
+
# datagram[2..33] is a message id
|
140
|
+
assert_equal 0, datagram[34].ord
|
141
|
+
assert_equal i, datagram[35].ord
|
142
|
+
assert_equal 0, datagram[36].ord
|
143
|
+
assert_equal datagrams.count, datagram[37].ord
|
144
|
+
end
|
145
|
+
end
|
129
146
|
end
|
130
147
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alexey Palazhchenko
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-29 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -114,5 +114,5 @@ specification_version: 3
|
|
114
114
|
summary: Library to send GELF messages to Graylog2 logging server
|
115
115
|
test_files:
|
116
116
|
- test/helper.rb
|
117
|
-
- test/test_notifier.rb
|
118
117
|
- test/test_deprecations.rb
|
118
|
+
- test/test_notifier.rb
|