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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15da1aa320c8738cfa0e523bbebe859987594ec3
4
- data.tar.gz: b807b4761bd2dccce15e79769fc685f7676c2c26
3
+ metadata.gz: f6a93988045d24764923b568a147c4a83d321e60
4
+ data.tar.gz: 10fe52c3063377b3e4b69ed559fe1fa3f5344d43
5
5
  SHA512:
6
- metadata.gz: 3143fc65c2f6c2deb2ddbbe79e9ec00092355d8a518ec4d63f0af5a7cc425671fa28b2ae1b8cece4799db18c10969c76494140ee6f7c2ebbfb97e32dd3099870
7
- data.tar.gz: fda5e4ee713cd2f4941c7afcd41db81a428a05ec99da21ab318606b7ed631bb84e751f9cc6ea7e2fafcc67028bf1c4169b2ad9ec3404f7c5fcbc8c3a044eab08
6
+ metadata.gz: 5e08262a0e9bfdf38823d9f64b405095d7b2d5ace369301bb764151961c4c4eb83e0c7329ca1c6fc3225ad1768ab176504f33c5da131a5e814aaa55722351806
7
+ data.tar.gz: 057feb948f7d3adb76c9d18e44d399bd5d30a328721c95f469cf1dae17f4aac1519b3f38f4e8895057f5f6b0d70c3244296067fdea68f0bac8b2589845a50e2b
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in vx-lib-logger.gemspec
4
4
  gemspec
5
+
6
+ gem 'minitest'
@@ -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)
@@ -1,7 +1,7 @@
1
1
  module Vx
2
2
  module Lib
3
3
  module Logger
4
- VERSION = "0.3.7"
4
+ VERSION = "0.3.8"
5
5
  end
6
6
  end
7
7
  end
@@ -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:9999'
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
- assert_equal "Hello\n", re
19
+ assert_match(/^Hello\n/, re)
20
20
  end
21
21
 
22
22
  it "should successfuly lost connection" do
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Vx::Lib::Logger::LogstashLogger do
4
4
 
5
5
  before do
6
- ENV['LOGSTASH_HOST'] = 'localhost:9999'
6
+ ENV['LOGSTASH_HOST'] = 'localhost:19999'
7
7
 
8
8
  @log = Vx::Lib::Logger::LogstashLogger.new
9
9
  assert @log
data/spec/spec_helper.rb CHANGED
@@ -10,7 +10,7 @@ end
10
10
 
11
11
  def with_socket
12
12
  out = ""
13
- server = TCPServer.new 9999
13
+ server = TCPServer.new '127.0.0.1', 19999
14
14
 
15
15
  th = Thread.new do
16
16
  loop do
data/vexor.yml CHANGED
@@ -1,3 +1,5 @@
1
1
  language: ruby
2
2
 
3
- rvm: 2.1
3
+ rvm:
4
+ - 2.1
5
+ - 2.2
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.7
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-17 00:00:00.000000000 Z
11
+ date: 2015-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj