slack_log_device 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/slack_log_device.rb +3 -2
- data/spec/slack_log_device_spec.rb +13 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: feb18f4dd60aea4737970379437c978db6e095af
|
4
|
+
data.tar.gz: 25a301a2cefb6dd06848f7dc61b2690ae4737e30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bec1c9a67055026237bb21214d70b6bdea7986a095d40d9d4f1c77af636543cba943f481e60832418f5936a5f6b6847c823205a5d33ae4abbbc04d8c35e76a97
|
7
|
+
data.tar.gz: 8f04f820add55f2b4567355280d8542f37c554149602f9fb15171b5e28582bf91c53e7b6278aedcdf4ca95b793b748736ff5719b79261a46cee5d2e5cef6a391
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.2
|
data/lib/slack_log_device.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'active_support/core_ext/hash'
|
2
|
+
require 'active_support/core_ext/integer'
|
2
3
|
require 'active_support/core_ext/string'
|
3
4
|
require 'httparty'
|
4
5
|
require 'logger'
|
@@ -15,7 +16,7 @@ class SlackLogDevice
|
|
15
16
|
self.auto_flush = options[:auto_flush]
|
16
17
|
self.channel = options[:channel]
|
17
18
|
self.flush_delay = options.key?(:flush_delay) ? options[:flush_delay] : 1
|
18
|
-
self.max_buffer_size = options.key?(:max_buffer_size) ? options[:max_buffer_size] :
|
19
|
+
self.max_buffer_size = options.key?(:max_buffer_size) ? options[:max_buffer_size] : 1024 * 128
|
19
20
|
self.timeout = options.key?(:timeout) ? options[:timeout] : 5
|
20
21
|
self.username = options[:username]
|
21
22
|
self.webhook_url = options[:webhook_url]
|
@@ -52,7 +53,7 @@ class SlackLogDevice
|
|
52
53
|
data['username'] = username if username.present?
|
53
54
|
begin
|
54
55
|
HTTParty.post(webhook_url, body: data.to_json, headers: { 'Content-Type': 'application/json' }, timeout: timeout)
|
55
|
-
rescue => e
|
56
|
+
rescue Exception => e
|
56
57
|
STDERR.puts(e)
|
57
58
|
end
|
58
59
|
nil
|
@@ -247,8 +247,8 @@ describe SlackLogDevice do
|
|
247
247
|
|
248
248
|
describe '#max_buffer_size' do
|
249
249
|
|
250
|
-
it 'is
|
251
|
-
expect(device.max_buffer_size).to eq(
|
250
|
+
it 'is 128 kilobytes by default' do
|
251
|
+
expect(device.max_buffer_size).to eq(1024 * 128)
|
252
252
|
end
|
253
253
|
|
254
254
|
it 'can be specified' do
|
@@ -296,7 +296,7 @@ describe SlackLogDevice do
|
|
296
296
|
it 'can be set' do
|
297
297
|
expect {
|
298
298
|
device.max_buffer_size = 1024
|
299
|
-
}.to change { device.max_buffer_size }.from(
|
299
|
+
}.to change { device.max_buffer_size }.from(1024 * 128).to(1024)
|
300
300
|
end
|
301
301
|
|
302
302
|
end
|
@@ -512,6 +512,16 @@ describe SlackLogDevice do
|
|
512
512
|
expect(logdev).to be_a(Logger::LogDevice)
|
513
513
|
end
|
514
514
|
|
515
|
+
describe '#dev' do
|
516
|
+
|
517
|
+
let(:dev) { logdev.dev }
|
518
|
+
|
519
|
+
it 'is SlackLogDevice instance' do
|
520
|
+
expect(dev).to be(device)
|
521
|
+
end
|
522
|
+
|
523
|
+
end
|
524
|
+
|
515
525
|
describe '#filename' do
|
516
526
|
|
517
527
|
it 'is nil' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack_log_device
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Toulotte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|