logstash-logger 0.19.2 → 0.20.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39bb1c811b357832fdd87f4f5c912244b4906d85
4
- data.tar.gz: ac31561fa06f8e6eda9008f954596919771f1d1d
3
+ metadata.gz: 196b7e18d4d98527c06d70185582c73b9da1ec2b
4
+ data.tar.gz: acd8028a656657d23e14e4bcef145369d25436d7
5
5
  SHA512:
6
- metadata.gz: 86f24b4b12939ea038c60994dd6a278b03e59a5226bbb80587e667d79f78cc21c7c8819328b2eaecafe7b9651415fa4d0ebbc1dab75b464fc0f9534719fc129d
7
- data.tar.gz: a696a3440c71cc46c49bdfe9c00e4f2b66135c348bfe50c1161cb4fb9e2b7dcb6e0794f3490955494e10032cdbb5e6b5542881318d013d9b197f695a49febfd7
6
+ metadata.gz: e0d45efee027eedb19baef974417f476296f0b2ec966f33f9faa2d3a5fdc2730e6c3548f95d662c2fb05680e6d33facfecbb922fbffd35fd99fcf8ee4db1f537
7
+ data.tar.gz: ce22eda2f3cc87947b242e739bbede3a0ce02b44435304a2734b51fb97137b6bd6c6e23d2a42a3e746beb5a8b2185c56608b10472ed2556ddff944c04ea866f0
@@ -1,3 +1,6 @@
1
+ ## 0.20.0
2
+ - Adds support for logging debug/error information for the connectable device's buffer. [#102](https://github.com/dwbutler/logstash-logger/pull/102)
3
+
1
4
  ## 0.19.2
2
5
 
3
6
  - Fixes mutex and memory leak issues when resetting buffer.
data/README.md CHANGED
@@ -254,6 +254,7 @@ You can configure its behavior by passing the following options to LogStashLogge
254
254
  * :drop_messages_on_full_buffer - Drop messages when the buffer is full. Defaults to true.
255
255
  * :sync - Flush buffer every time a message is received (blocking). Defaults to false.
256
256
  * :buffer_flush_at_exit - Flush messages when exiting the program. Defaults to true.
257
+ * :buffer_logger - Logger to write buffer debug/error messages to. Defaults to none.
257
258
 
258
259
  You can turn buffering off by setting `sync = true`.
259
260
 
@@ -225,14 +225,17 @@ module LogStashLogger
225
225
  buffer_clear_pending
226
226
  end
227
227
 
228
- @buffer_config[:logger].debug("Flushing output",
229
- :outgoing_count => @buffer_state[:outgoing_count],
230
- :time_since_last_flush => time_since_last_flush,
231
- :outgoing_events => @buffer_state[:outgoing_items],
232
- :batch_timeout => @buffer_config[:max_interval],
233
- :force => force,
234
- :final => final
235
- ) if @buffer_config[:logger]
228
+ @buffer_config[:logger].debug do
229
+ debug_output = {
230
+ :outgoing_count => @buffer_state[:outgoing_count],
231
+ :time_since_last_flush => time_since_last_flush,
232
+ :outgoing_events => @buffer_state[:outgoing_items],
233
+ :batch_timeout => @buffer_config[:max_interval],
234
+ :force => force,
235
+ :final => final
236
+ }
237
+ "Flushing output: #{debug_output}"
238
+ end if @buffer_config[:logger]
236
239
 
237
240
  @buffer_state[:outgoing_items].each do |group, events|
238
241
  begin
@@ -250,11 +253,14 @@ module LogStashLogger
250
253
 
251
254
  rescue => e
252
255
 
253
- @buffer_config[:logger].warn("Failed to flush outgoing items",
254
- :outgoing_count => @buffer_state[:outgoing_count],
255
- :exception => e.class.name,
256
- :backtrace => e.backtrace
257
- ) if @buffer_config[:logger]
256
+ @buffer_config[:logger].warn do
257
+ warn_output = {
258
+ :outgoing_count => @buffer_state[:outgoing_count],
259
+ :exception => e.class.name,
260
+ :backtrace => e.backtrace
261
+ }
262
+ "Failed to flush outgoing items: #{warn_output}"
263
+ end if @buffer_config[:logger]
258
264
 
259
265
  if @buffer_config[:has_on_flush_error]
260
266
  on_flush_error e
@@ -5,6 +5,8 @@ module LogStashLogger
5
5
  class Connectable < Base
6
6
  include LogStashLogger::Buffer
7
7
 
8
+ attr_accessor :buffer_logger
9
+
8
10
  def initialize(opts = {})
9
11
  super
10
12
 
@@ -40,9 +42,12 @@ module LogStashLogger
40
42
  true
41
43
  end
42
44
 
45
+ @buffer_logger = opts[:buffer_logger]
46
+
43
47
  buffer_initialize(
44
48
  max_items: @buffer_max_items,
45
49
  max_interval: @buffer_max_interval,
50
+ logger: buffer_logger,
46
51
  autoflush: @sync,
47
52
  drop_messages_on_flush_error: @drop_messages_on_flush_error,
48
53
  drop_messages_on_full_buffer: @drop_messages_on_full_buffer,
@@ -1,3 +1,3 @@
1
1
  module LogStashLogger
2
- VERSION = "0.19.2"
2
+ VERSION = "0.20.0"
3
3
  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.19.2
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Butler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-24 00:00:00.000000000 Z
11
+ date: 2016-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-event