logstash-core-event-java 5.0.0.alpha6.snapshot1-java → 5.0.0.alpha6.snapshot2-java
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1387a75d98e940027af5034b31b876f82799643
|
4
|
+
data.tar.gz: 60c8731f4dc1680a2555f4b541dc583a8d347f85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35600341c26ba7092837511656281532185c0583ddaad4bdd2c548175b45ef7800f74dcbb191014b0a492f49ca37a092730a841cd937fe2e86c0eb34cc87e927
|
7
|
+
data.tar.gz: dfa30f2561e5559271e30a8873178a1401723c9689dcc4753bca51a0c50047fc3b7b93101d2fc14ea99eb95637ab963a6baff5a9d01ddb047c3372de9bd273e7
|
data/lib/logstash/event.rb
CHANGED
@@ -3,21 +3,32 @@
|
|
3
3
|
require "logstash/namespace"
|
4
4
|
require "logstash/json"
|
5
5
|
require "logstash/string_interpolation"
|
6
|
-
require "cabin"
|
7
6
|
|
8
7
|
# transcient pipeline events for normal in-flow signaling as opposed to
|
9
8
|
# flow altering exceptions. for now having base classes is adequate and
|
10
9
|
# in the future it might be necessary to refactor using like a BaseEvent
|
11
10
|
# class to have a common interface for all pileline events to support
|
12
11
|
# eventual queueing persistence for example, TBD.
|
13
|
-
class LogStash::ShutdownEvent; end
|
14
|
-
class LogStash::FlushEvent; end
|
15
|
-
|
16
12
|
module LogStash
|
17
|
-
|
13
|
+
class SignalEvent
|
14
|
+
def flush?; raise "abstract method"; end;
|
15
|
+
def shutdown?; raise "abstract method"; end;
|
16
|
+
end
|
17
|
+
|
18
|
+
class ShutdownEvent < SignalEvent
|
19
|
+
def flush?; false; end;
|
20
|
+
def shutdown?; true; end;
|
21
|
+
end
|
22
|
+
|
23
|
+
class FlushEvent < SignalEvent
|
24
|
+
def flush?; true; end;
|
25
|
+
def shutdown?; false; end;
|
26
|
+
end
|
27
|
+
|
28
|
+
FLUSH = FlushEvent.new
|
18
29
|
|
19
30
|
# LogStash::SHUTDOWN is used by plugins
|
20
|
-
SHUTDOWN =
|
31
|
+
SHUTDOWN = ShutdownEvent.new
|
21
32
|
end
|
22
33
|
|
23
34
|
# for backward compatibility, require "logstash/event" is used a lots of places so let's bootstrap the
|
Binary file
|
data/spec/event_spec.rb
CHANGED
@@ -194,62 +194,27 @@ describe LogStash::Event do
|
|
194
194
|
end
|
195
195
|
|
196
196
|
|
197
|
-
#
|
198
|
-
#
|
199
|
-
# method is used in Event.
|
200
|
-
module DummyLogger
|
201
|
-
def self.warn(message)
|
202
|
-
# do nothing
|
203
|
-
end
|
204
|
-
end
|
197
|
+
# TODO(talevy): migrate tests to Java. no reason to test logging logic in ruby when it is being
|
198
|
+
# done in java land.
|
205
199
|
|
206
|
-
context "logger" do
|
200
|
+
# context "logger" do
|
207
201
|
|
208
|
-
|
209
|
-
after(:each) { LogStash::Event.logger = LogStash::Event::DEFAULT_LOGGER }
|
202
|
+
# let(:logger) { double("Logger") }
|
210
203
|
|
211
|
-
|
212
|
-
|
213
|
-
|
204
|
+
# before(:each) do
|
205
|
+
# allow(LogStash::Event).to receive(:logger).and_return(logger)
|
206
|
+
# end
|
214
207
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
end
|
208
|
+
# it "should set logger using a module" do
|
209
|
+
# expect(logger).to receive(:warn).once
|
210
|
+
# LogStash::Event.new(TIMESTAMP => "invalid timestamp")
|
211
|
+
# end
|
220
212
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
it "should unset logger" do
|
228
|
-
# first set
|
229
|
-
LogStash::Event.logger = logger
|
230
|
-
expect(logger).to receive(:warn).once
|
231
|
-
LogStash::Event.new(TIMESTAMP => "invalid timestamp")
|
232
|
-
|
233
|
-
# then unset
|
234
|
-
LogStash::Event.logger = LogStash::Event::DEFAULT_LOGGER
|
235
|
-
expect(logger).to receive(:warn).never
|
236
|
-
# this will produce a log line in stdout by the Java Event
|
237
|
-
LogStash::Event.new(TIMESTAMP => "ignore this log")
|
238
|
-
end
|
239
|
-
|
240
|
-
|
241
|
-
it "should warn on parsing error" do
|
242
|
-
LogStash::Event.logger = logger
|
243
|
-
expect(logger).to receive(:warn).once.with(/^Error parsing/)
|
244
|
-
LogStash::Event.new(TIMESTAMP => "invalid timestamp")
|
245
|
-
end
|
246
|
-
|
247
|
-
it "should warn on invalid timestamp object" do
|
248
|
-
LogStash::Event.logger = logger
|
249
|
-
expect(logger).to receive(:warn).once.with(/^Unrecognized/)
|
250
|
-
LogStash::Event.new(TIMESTAMP => Array.new)
|
251
|
-
end
|
252
|
-
end
|
213
|
+
# it "should warn on invalid timestamp object" do
|
214
|
+
# expect(logger).to receive(:warn).once.with(/^Unrecognized/)
|
215
|
+
# LogStash::Event.new(TIMESTAMP => Array.new)
|
216
|
+
# end
|
217
|
+
# end
|
253
218
|
|
254
219
|
context "to_hash" do
|
255
220
|
let (:source_hash) { {"a" => 1, "b" => [1, 2, 3, {"h" => 1, "i" => "baz"}], "c" => {"d" => "foo", "e" => "bar", "f" => [4, 5, "six"]}} }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-core-event-java
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.alpha6.
|
4
|
+
version: 5.0.0.alpha6.snapshot2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|