logstash-logger 0.18.1 → 0.19.0

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: 8c298d6d9cfea903f52d0266d58c0c887dbe9e2c
4
- data.tar.gz: c7916b26bee361a119adbad04491c8cebd4d205d
3
+ metadata.gz: 87c30ee495dde3dc0d332c0c112108f14bf66dc5
4
+ data.tar.gz: da338ca8a8eb2595740199307a14b9f7526f0886
5
5
  SHA512:
6
- metadata.gz: d8de39c73c3ec230c28a607b7585caaa6fbed31236124260ec543fdd759d7d0239704106acf99317b47c10b586ac3d1a374aa99615d7d18ea595f81feb0d2c44
7
- data.tar.gz: b2f261d89e6e161af28d34f0e9a30e2fb3a51ea2f2bd34218c085bff6990ddbfba2a7cc03093d864964893bdbd469939459181cfc7f941271c2052e614040feb
6
+ metadata.gz: de82021502e6ff643318b41a82fa8a8b135e0215c65d2f2d92356d00deb39d32a89571e5dfb8fc3441ef92fa4cfd4b23159fef69fe08640db1817b97488383d9
7
+ data.tar.gz: d8046cde7755499f924b90dc9dc4045d2de9567e5492241c241e3d22c1ce8cd157a7b9195cde444db8a3411f3a973c12c14ab4d9be862d02342322f1686bc471
@@ -1,3 +1,7 @@
1
+ ## 0.19.0
2
+
3
+ - Flush buffered messages when exiting. [#92](https://github.com/dwbutler/logstash-logger/pull/92)
4
+
1
5
  ## 0.18.1
2
6
 
3
7
  - Fixes usage of ActiveSupport without Rails. [#90](https://github.com/dwbutler/logstash-logger/pull/90)
data/README.md CHANGED
@@ -253,6 +253,7 @@ You can configure its behavior by passing the following options to LogStashLogge
253
253
  * :drop_messages_on_flush_error - Drop messages when there is a flush error. Defaults to false.
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
+ * :buffer_flush_at_exit - Flush messages when exiting the program. Defaults to true.
256
257
 
257
258
  You can turn buffering off by setting `sync = true`.
258
259
 
@@ -95,9 +95,14 @@ module LogStashLogger
95
95
  :has_on_flush_error => self.class.method_defined?(:on_flush_error),
96
96
  :has_on_full_buffer_receive => self.class.method_defined?(:on_full_buffer_receive),
97
97
  :drop_messages_on_flush_error => options.fetch(:drop_messages_on_flush_error, false),
98
- :drop_messages_on_full_buffer => options.fetch(:drop_messages_on_full_buffer, false)
98
+ :drop_messages_on_full_buffer => options.fetch(:drop_messages_on_full_buffer, false),
99
+ :flush_at_exit => options.fetch(:flush_at_exit, false)
99
100
  }
100
101
 
102
+ if @buffer_config[:flush_at_exit]
103
+ at_exit { buffer_flush(final: true) }
104
+ end
105
+
101
106
  reset_buffer
102
107
  end
103
108
 
@@ -33,12 +33,20 @@ module LogStashLogger
33
33
  true
34
34
  end
35
35
 
36
+ @buffer_flush_at_exit =
37
+ if opts.key?(:buffer_flush_at_exit)
38
+ opts.delete(:buffer_flush_at_exit)
39
+ else
40
+ true
41
+ end
42
+
36
43
  buffer_initialize(
37
44
  max_items: @buffer_max_items,
38
45
  max_interval: @buffer_max_interval,
39
46
  autoflush: @sync,
40
47
  drop_messages_on_flush_error: @drop_messages_on_flush_error,
41
- drop_messages_on_full_buffer: @drop_messages_on_full_buffer
48
+ drop_messages_on_full_buffer: @drop_messages_on_full_buffer,
49
+ flush_at_exit: @buffer_flush_at_exit
42
50
  )
43
51
  end
44
52
 
@@ -1,3 +1,3 @@
1
1
  module LogStashLogger
2
- VERSION = "0.18.1"
2
+ VERSION = "0.19.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.18.1
4
+ version: 0.19.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-08-04 00:00:00.000000000 Z
11
+ date: 2016-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-event