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 +4 -4
- data/lib/logfoo/context.rb +23 -20
- data/lib/logfoo/version.rb +1 -1
- data/lib/logfoo.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2e939727dbc274fb8357a2ecb83aa2fc4e9c87c
|
4
|
+
data.tar.gz: f2171b51c524f76df2e8338e191315be794cbabc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00d1e84369ae5057cdd0ea5c06f4399578e1f0413df9076c8d23db302e3ce78e3cf03f98c3e6c51560d8df26fae24bc415eb73cc41488e84bf53e5853b403237
|
7
|
+
data.tar.gz: 40a582fea0ebbf9a700469e41f26110ec8896cd59b98ead9719eaf079c9575b0a84c5c00e50d27a7682b8a4470e621dee8f5aaad82868196a456863b3687eac9
|
data/lib/logfoo/context.rb
CHANGED
@@ -33,31 +33,34 @@ module Logfoo
|
|
33
33
|
end
|
34
34
|
|
35
35
|
Logfoo::LEVELS.each_with_index do |lv, idx|
|
36
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
45
|
+
if idx >= level
|
46
|
+
message = block ? block.call : message
|
47
|
+
payload = @context.merge(payload || {})
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
data/lib/logfoo/version.rb
CHANGED
data/lib/logfoo.rb
CHANGED