after_do-logging 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/after_do/logging/aspect.rb +10 -6
- data/lib/after_do/logging/version.rb +1 -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: c8d051b7016ec975084334db4ac7f987e167126e
|
4
|
+
data.tar.gz: 73d4106606718c0e14fecd9e5e9c5acd631e9dcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe7d90cadf5a417cd8ab51fe63e2692914e08ae92153aef7ae27059347373587e57d86c21ee390c789be408f6ffa108d335d62e2db2c60c04cac0f60bca2c7f4
|
7
|
+
data.tar.gz: 2f129d695fbd4353c289bb42881add1e789c4d0e3085f7ea48f9c74a619bc52239fec15aa86b59f025d9b1ded2d58520ccb45a9185221b02bf030b940c4fde88
|
@@ -7,18 +7,18 @@ module AfterDo
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def log_start(target_method)
|
10
|
-
target_class.before target_method do |*args,
|
10
|
+
target_class.before target_method do |*args, object|
|
11
11
|
method = "#{target_class}##{target_method}"
|
12
12
|
|
13
|
-
log_step('Started', method, args)
|
13
|
+
log_step('Started', object, method, args)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
def log_finish(target_method)
|
18
|
-
target_class.after target_method do |*args,
|
18
|
+
target_class.after target_method do |*args, object|
|
19
19
|
method = "#{target_class}##{target_method}"
|
20
20
|
|
21
|
-
log_step('Finished', method, args)
|
21
|
+
log_step('Finished', object, method, args)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -28,11 +28,15 @@ module AfterDo
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
-
def log_step(prefix, method, args)
|
31
|
+
def log_step(prefix, object, method, args)
|
32
32
|
arg_text = args.map(&:inspect).join(', ')
|
33
|
-
msg = "#{prefix}: #{method}(#{arg_text})"
|
33
|
+
msg = "#{prefix}#{id(object)}: #{method}(#{arg_text})"
|
34
34
|
logger.info(msg)
|
35
35
|
end
|
36
|
+
|
37
|
+
def id(object)
|
38
|
+
"[#{object.id}]" if object.respond_to?(:id)
|
39
|
+
end
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: after_do-logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael da Silva
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-09-
|
12
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: after_do
|