vx-lib-logger 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/lib/vx/lib/logger/base_logger.rb +7 -4
- data/lib/vx/lib/logger/version.rb +1 -1
- data/spec/lib/logstash_device_spec.rb +2 -2
- data/spec/lib/logstash_logger_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/vexor.yml +3 -1
- 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: f6a93988045d24764923b568a147c4a83d321e60
|
4
|
+
data.tar.gz: 10fe52c3063377b3e4b69ed559fe1fa3f5344d43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e08262a0e9bfdf38823d9f64b405095d7b2d5ace369301bb764151961c4c4eb83e0c7329ca1c6fc3225ad1768ab176504f33c5da131a5e814aaa55722351806
|
7
|
+
data.tar.gz: 057feb948f7d3adb76c9d18e44d399bd5d30a328721c95f469cf1dae17f4aac1519b3f38f4e8895057f5f6b0d70c3244296067fdea68f0bac8b2589845a50e2b
|
data/Gemfile
CHANGED
@@ -25,8 +25,8 @@ module Vx ; module Lib ; module Logger
|
|
25
25
|
end
|
26
26
|
|
27
27
|
[:fatal, :warn, :debug, :error, :info].each do |m|
|
28
|
-
define_method m do |*args|
|
29
|
-
process_message(m, *args)
|
28
|
+
define_method m do |*args, &block|
|
29
|
+
process_message(m, *args, &block)
|
30
30
|
end
|
31
31
|
|
32
32
|
define_method :"#{m}?" do
|
@@ -60,7 +60,10 @@ module Vx ; module Lib ; module Logger
|
|
60
60
|
|
61
61
|
private
|
62
62
|
|
63
|
-
def process_message(level, message, fields = {})
|
63
|
+
def process_message(level, message = nil, fields = {})
|
64
|
+
if block_given?
|
65
|
+
message = yield
|
66
|
+
end
|
64
67
|
|
65
68
|
if fields[:exception] && fields[:exception].is_a?(Exception)
|
66
69
|
ex = fields.delete(:exception)
|
@@ -86,7 +89,7 @@ module Vx ; module Lib ; module Logger
|
|
86
89
|
)
|
87
90
|
end
|
88
91
|
|
89
|
-
@logger.public_send level, format_message(level, message, payload)
|
92
|
+
@logger.public_send level, format_message(level, message.to_s, payload)
|
90
93
|
end
|
91
94
|
|
92
95
|
def sanitize_hash(payload)
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Vx::Lib::Logger::LogstashDevice do
|
4
4
|
|
5
5
|
before do
|
6
|
-
ENV['LOGSTASH_HOST'] = 'localhost:
|
6
|
+
ENV['LOGSTASH_HOST'] = 'localhost:19999'
|
7
7
|
end
|
8
8
|
|
9
9
|
after do
|
@@ -16,7 +16,7 @@ describe Vx::Lib::Logger::LogstashDevice do
|
|
16
16
|
log.write("Hello\n")
|
17
17
|
log.close
|
18
18
|
end
|
19
|
-
|
19
|
+
assert_match(/^Hello\n/, re)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should successfuly lost connection" do
|
data/spec/spec_helper.rb
CHANGED
data/vexor.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vx-lib-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Galinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|