logfoo 0.0.12 → 0.0.13

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: 26231e01bc62ebf274d586683728058b0f7e847a
4
- data.tar.gz: b983ff461b55ab949b0c89151d6eec667713215e
3
+ metadata.gz: f2e939727dbc274fb8357a2ecb83aa2fc4e9c87c
4
+ data.tar.gz: f2171b51c524f76df2e8338e191315be794cbabc
5
5
  SHA512:
6
- metadata.gz: 6d187b4ff7a69d63413f778046b338b7c4d6f9ac452e0424da76f98bc64829660e18d85bad866c61683577805c9ed9e0751692a6fb2e63f9b867f0a9dbec88dd
7
- data.tar.gz: 09efe0912a5f9b58b6044bddbe0561284155ecc209ca2b5db2fbfc5115f509a2daf383b74f3574c6fe69dbc1049250cbdf1ed248c268cce8a5db3ea1ac919142
6
+ metadata.gz: 00d1e84369ae5057cdd0ea5c06f4399578e1f0413df9076c8d23db302e3ce78e3cf03f98c3e6c51560d8df26fae24bc415eb73cc41488e84bf53e5853b403237
7
+ data.tar.gz: 40a582fea0ebbf9a700469e41f26110ec8896cd59b98ead9719eaf079c9575b0a84c5c00e50d27a7682b8a4470e621dee8f5aaad82868196a456863b3687eac9
@@ -33,31 +33,34 @@ module Logfoo
33
33
  end
34
34
 
35
35
  Logfoo::LEVELS.each_with_index do |lv, idx|
36
- level_id = lv.downcase.to_sym
37
-
38
- define_method :"#{level_id}?" do
36
+ define_method :"#{lv.downcase}?" do
39
37
  idx >= level
40
38
  end
39
+ end
40
+
41
+ Logfoo::LEVELS.each_with_index do |lv, idx|
42
+ level_id = lv.downcase.to_sym
41
43
 
42
44
  define_method level_id do |message = nil, payload = nil, &block|
43
- return if idx < level
44
- message = block ? block.call : message
45
- payload = @context.merge(payload || {})
45
+ if idx >= level
46
+ message = block ? block.call : message
47
+ payload = @context.merge(payload || {})
46
48
 
47
- entry =
48
- if message.is_a?(Exception)
49
- ExceptionEntry.build(@scope, message, payload, level: level_id)
50
- else
51
- Entry.new(
52
- level_id,
53
- Time.now,
54
- @scope,
55
- message,
56
- payload,
57
- Thread.current.object_id
58
- )
59
- end
60
- @app.append(entry)
49
+ entry =
50
+ if message.is_a?(Exception)
51
+ ExceptionEntry.build(@scope, message, payload, level: level_id)
52
+ else
53
+ Entry.new(
54
+ level_id,
55
+ Time.now,
56
+ @scope,
57
+ message,
58
+ payload,
59
+ Thread.current.object_id
60
+ )
61
+ end
62
+ @app.append(entry)
63
+ end
61
64
  end
62
65
  end
63
66
  end
@@ -1,3 +1,3 @@
1
1
  module Logfoo
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.13'
3
3
  end
data/lib/logfoo.rb CHANGED
@@ -38,4 +38,8 @@ end
38
38
  require File.expand_path("../logfoo/#{f}", __FILE__)
39
39
  end
40
40
 
41
- at_exit { Logfoo.stop }
41
+ if defined?(Minitest)
42
+ Minitest.after_run { Logfoo.stop }
43
+ else
44
+ at_exit { Logfoo.stop }
45
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logfoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Galinsky