1 | 0 | |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package pt.digitalis.dif.utils.logging; |
8 | |
|
9 | |
import org.aspectj.lang.JoinPoint; |
10 | |
import org.aspectj.lang.Signature; |
11 | |
|
12 | |
import pt.digitalis.log.LogLevel; |
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | 0 | public aspect DIFCoreTracingAspect extends DIFLogAspect { |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
after() : allConstructors() |
28 | |
{ |
29 | 0 | if (super.getLogger().isTraceEnabled()) { |
30 | |
|
31 | 0 | JoinPoint.StaticPart joinPointStaticPart = thisJoinPointStaticPart; |
32 | |
|
33 | |
|
34 | 0 | if (joinPointStaticPart != null) { |
35 | 0 | super.getLogger().increaseIndentation(); |
36 | |
|
37 | 0 | Signature signature = joinPointStaticPart.getSignature(); |
38 | 0 | super.getLogger().log( |
39 | 0 | LogLevel.TRACE, |
40 | 0 | super.getLogger().getIndentationString() + "Constructed: " |
41 | 0 | + signature.getDeclaringType().getName()); |
42 | |
|
43 | 0 | super.getLogger().decreaseIndentation(); |
44 | |
} |
45 | |
} |
46 | 0 | } |
47 | |
|
48 | |
|
49 | |
before() : allMethods() |
50 | |
{ |
51 | 0 | if (super.getLogger().isTraceEnabled()) { |
52 | 0 | super.getLogger().increaseIndentation(); |
53 | |
|
54 | 0 | JoinPoint.StaticPart joinPointStaticPart = thisJoinPointStaticPart; |
55 | |
|
56 | |
|
57 | 0 | if (joinPointStaticPart != null) { |
58 | 0 | Signature signature = joinPointStaticPart.getSignature(); |
59 | 0 | super.getLogger().log( |
60 | 0 | LogLevel.TRACE, |
61 | 0 | super.getLogger().getIndentationString() + "Entering: " |
62 | 0 | + signature.getDeclaringType().getName() + "." + signature.getName()); |
63 | |
} |
64 | |
} |
65 | |
|
66 | 0 | } |
67 | |
|
68 | |
|
69 | |
after() : allMethods() |
70 | |
{ |
71 | 0 | if (super.getLogger().isTraceEnabled()) { |
72 | |
|
73 | 0 | JoinPoint.StaticPart joinPointStaticPart = thisJoinPointStaticPart; |
74 | |
|
75 | |
|
76 | 0 | if (joinPointStaticPart != null) { |
77 | 0 | Signature signature = joinPointStaticPart.getSignature(); |
78 | 0 | super.getLogger().log( |
79 | 0 | LogLevel.TRACE, |
80 | 0 | super.getLogger().getIndentationString() + "Exiting: " + signature.getDeclaringType().getName() |
81 | 0 | + "." + signature.getName()); |
82 | |
} |
83 | |
|
84 | 0 | super.getLogger().decreaseIndentation(); |
85 | |
} |
86 | |
|
87 | 0 | } |
88 | |
} |