pluslog 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pluslog.rb +4 -2
- metadata +1 -1
data/lib/pluslog.rb
CHANGED
@@ -10,8 +10,9 @@ def nil.+@
|
|
10
10
|
method = klass.instance_method(name)
|
11
11
|
klass.send(:define_method, name) do |*args|
|
12
12
|
Pluslogger.log "enter #{name}"
|
13
|
-
Pluslogger.new { method.bind(self).call(*args) }
|
13
|
+
res = Pluslogger.new { method.bind(self).call(*args) }
|
14
14
|
Pluslogger.log "exit #{name}"
|
15
|
+
res
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
@@ -29,7 +30,8 @@ class Pluslogger
|
|
29
30
|
def self.new(&block)
|
30
31
|
Thread.current[:depth] ||= 0
|
31
32
|
Thread.current[:depth] += 1
|
32
|
-
block.call
|
33
|
+
res = block.call
|
33
34
|
Thread.current[:depth] -= 1
|
35
|
+
res
|
34
36
|
end
|
35
37
|
end
|