md-logstasher 1.5.0 → 1.6.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
  SHA256:
3
- metadata.gz: 2a3ecf9c0501945ebb201adb054bcb8e419ab6282e4373fcc5f83c141f0fe606
4
- data.tar.gz: 52acbb7139d4f00775f0ad88115a0237dee699aa8ce42fc8b9c0aabdd9786438
3
+ metadata.gz: 628b152041e0a0d8218761c1ab723f43b16ff6a9746fcf102e5b0a8d03aea76e
4
+ data.tar.gz: a3283254f14aef786d70dda74cae35d081d607e67a37522fff292ddab6119e80
5
5
  SHA512:
6
- metadata.gz: 074e9580a2b16e2d9d25c948559a43c74d03ea3de65854b20c36fbaeb2f921d77ea11206533bebe6b9ed490d1ffc5e5f0951db1ed83f9275c5309c39cb9a78b6
7
- data.tar.gz: 8353c5595d42b6da680afbc7cf4b673bf23b5b2ba9f784e7bb9c1e5b34c5fe0faa3d9ba9c648cd449e50299691a7bb91f69b3ee46458d85f8074558146801c07
6
+ metadata.gz: 68806d2f4d08aa90a7c61487d2101e9cbfa2802d1021986dc39d1d9469196d8524d6e07cdcb63b3df104c0198beff6b9510f3f2d876ddc79b4c565b5f2d2fe1e
7
+ data.tar.gz: 38f876594090f8a545dcfcd5380142bbfb1d9b34c726b2d0cb6de96d547ee41aaf5463c245279adbe50d694f9ab6be0a30fd6cdc45ffd0ccf5efd1e66322065f
@@ -5,6 +5,7 @@ module LogStasher
5
5
  config.logstasher.include_parameters = true
6
6
  config.logstasher.serialize_parameters = true
7
7
  config.logstasher.silence_standard_logging = false
8
+ config.logstasher.silence_creation_message = true
8
9
  config.logstasher.logger = nil
9
10
  config.logstasher.log_level = ::Logger::INFO
10
11
 
@@ -49,7 +50,9 @@ module LogStasher
49
50
  def default_logger
50
51
  unless @default_logger
51
52
  path = ::Rails.root.join('log', "logstash_#{::Rails.env}.log")
52
- ::FileUtils.touch(path) # prevent autocreate messages in log
53
+ if config.logstasher.silence_creation_message
54
+ ::FileUtils.touch(path) # prevent autocreate messages in log
55
+ end
53
56
 
54
57
  @default_logger = ::Logger.new(path)
55
58
  end
@@ -1,3 +1,3 @@
1
1
  module LogStasher
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.0"
3
3
  end
@@ -18,6 +18,24 @@ end
18
18
  describe ::LogStasher::Railtie do
19
19
  let(:config) { described_class.config.logstasher }
20
20
 
21
+ describe 'logstasher should touch log file to prevent creation message by default' do
22
+ it 'should configure LogStasher' do
23
+ expect(::FileUtils).to receive(:touch)
24
+ ActiveSupport.run_load_hooks(:before_initialize)
25
+ end
26
+ end
27
+
28
+ describe 'logstasher should NOT touch log file if silence disabled' do
29
+ before { config.silence_creation_message = false }
30
+ after { config.silence_creation_message = true }
31
+
32
+ it 'should configure LogStasher' do
33
+ expect(::FileUtils).not_to receive(:touch)
34
+ ActiveSupport.run_load_hooks(:before_initialize)
35
+ end
36
+ end
37
+
38
+
21
39
  describe 'logstasher.configure' do
22
40
  it 'should configure LogStasher' do
23
41
  config.logger = ::Logger.new('/dev/null')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: md-logstasher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Devin Christensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-27 00:00:00.000000000 Z
11
+ date: 2022-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-event