logstash-logger 0.10.0 → 0.10.1

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: 03eb27ccbc6770bb3348ffcedd6fdc46ba789731
4
- data.tar.gz: 3d4d59a4c5a2b5ede515b44595c97fe73949d89d
3
+ metadata.gz: 951cad66dd80a5fab1d99deee38904ab91c8dc07
4
+ data.tar.gz: 65f9f5bb075bcb3586fef3dbebc3e29044de5529
5
5
  SHA512:
6
- metadata.gz: 454217b66be5ceeaa97f904b0218d1c24651cb865c7cafb1bc69702025b90d8fe8ca3a5337b77296aea8dda1c2e78bce669348708f950195e30706436f8a7c0e
7
- data.tar.gz: 3aa6228a59fbd9b540e5dc745caebebb2bfc11d65d16ad7265afd50a10710305e2cfc46ce1802118bbaf3fd8af25286b79c220efc93c7439c06924bb9a514735
6
+ metadata.gz: 3a75b6665961770c053c061fc5b1678e37e42c39372cd322cdeedcbc7e379bc3aa707bca6efd8bc551b1052a67ae148cf4bba6e416ed5d86f8d9a7ecac5b5f49
7
+ data.tar.gz: 08f67645cdde2de3a933773f8764de3e742aa3e3c52b8a693066a738f92d09d0334d214a2cdd378ff3059f3fe671ca4172d166e1043cbcebbc38e1fbf6407522
@@ -1,3 +1,8 @@
1
+ ## 0.10.1
2
+ - Fix for Redis URI parsing issue.
3
+ Fixes [#41](https://github.com/dwbutler/logstash-logger/issues/41).
4
+ Thanks [Vadim Kazakov](https://github.com/yads)!
5
+
1
6
  ## 0.10.0
2
7
  - Support for logging to Kafka.
3
8
  Fixes [#37](https://github.com/dwbutler/logstash-logger/issues/37).
data/README.md CHANGED
@@ -415,6 +415,7 @@ logger = LogStashLogger.new('localhost', 5228, :tcp)
415
415
  * [Kurt Preston](https://github.com/KurtPreston)
416
416
  * [Chris Blatchley](https://github.com/chrisblatchley)
417
417
  * [Felix Bechstein](https://github.com/felixb)
418
+ * [Vadim Kazakov](https://github.com/yads)
418
419
 
419
420
  ## Contributing
420
421
 
@@ -13,6 +13,9 @@ module LogStashLogger
13
13
  def initialize(opts)
14
14
  super
15
15
  @list = opts.delete(:list) || DEFAULT_LIST
16
+
17
+ normalize_path(opts)
18
+
16
19
  @redis_options = opts
17
20
 
18
21
  @batch_events = opts.fetch(:batch_events, 50)
@@ -21,6 +24,7 @@ module LogStashLogger
21
24
  buffer_initialize max_items: @batch_events, max_interval: @batch_timeout
22
25
  end
23
26
 
27
+
24
28
  def connect
25
29
  @io = ::Redis.new(@redis_options)
26
30
  end
@@ -64,6 +68,16 @@ module LogStashLogger
64
68
  end
65
69
  end
66
70
  end
71
+
72
+ private
73
+
74
+ def normalize_path(opts)
75
+ path = opts.fetch(:path, nil)
76
+ if path
77
+ opts[:db] = path.gsub("/", "").to_i unless path.empty?
78
+ opts.delete(:path)
79
+ end
80
+ end
67
81
 
68
82
  end
69
83
  end
@@ -1,3 +1,3 @@
1
1
  module LogStashLogger
2
- VERSION = "0.10.0"
2
+ VERSION = "0.10.1"
3
3
  end
@@ -19,4 +19,34 @@ describe LogStashLogger::Device::Redis do
19
19
  it "defaults the Redis list to 'logstash'" do
20
20
  expect(redis_device.list).to eq('logstash')
21
21
  end
22
+
23
+ describe "initializer" do
24
+ let(:redis_options) { { host: HOST, port: 6379 } }
25
+ subject { LogStashLogger::Device::Redis.new(redis_options).connect }
26
+
27
+ context "path is not blank" do
28
+ before do
29
+ redis_options[:path] = "/0"
30
+ end
31
+
32
+ it "sets the db" do
33
+ expect(Redis).to receive(:new).with(hash_including(db: 0))
34
+ subject
35
+ end
36
+
37
+ end
38
+
39
+ context "path is blank" do
40
+ before do
41
+ redis_options[:path] = ""
42
+ end
43
+
44
+ it "does not set the db" do
45
+ expect(Redis).to receive(:new).with(hash_excluding(:db))
46
+ subject
47
+ end
48
+ end
49
+
50
+ end
51
+
22
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Butler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-22 00:00:00.000000000 Z
11
+ date: 2015-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-event