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 +4 -4
- data/lib/logstasher/railtie.rb +4 -1
- data/lib/logstasher/version.rb +1 -1
- data/spec/lib/logstasher/railtie_spec.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 628b152041e0a0d8218761c1ab723f43b16ff6a9746fcf102e5b0a8d03aea76e
|
4
|
+
data.tar.gz: a3283254f14aef786d70dda74cae35d081d607e67a37522fff292ddab6119e80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68806d2f4d08aa90a7c61487d2101e9cbfa2802d1021986dc39d1d9469196d8524d6e07cdcb63b3df104c0198beff6b9510f3f2d876ddc79b4c565b5f2d2fe1e
|
7
|
+
data.tar.gz: 38f876594090f8a545dcfcd5380142bbfb1d9b34c726b2d0cb6de96d547ee41aaf5463c245279adbe50d694f9ab6be0a30fd6cdc45ffd0ccf5efd1e66322065f
|
data/lib/logstasher/railtie.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/logstasher/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2022-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-event
|