|
21 | 21 |
|
22 | 22 | publicclassAntRuleLoggerextendsAbstractRuleLogger { |
23 | 23 |
|
24 | | -privatestaticfinalStringLEVEL_PREFIX ="["; |
25 | | -privatestaticfinalStringLEVEL_SUFFIX ="] "; |
26 | | -privatestaticfinalStringDEBUG_LEVEL_PREFIX =LEVEL_PREFIX +"DEBUG" +LEVEL_SUFFIX; |
27 | | -privatestaticfinalStringERROR_LEVEL_PREFIX =LEVEL_PREFIX +"ERROR" +LEVEL_SUFFIX; |
28 | | -privatestaticfinalStringINFO_LEVEL_PREFIX =LEVEL_PREFIX +"INFO" +LEVEL_SUFFIX; |
29 | | -privatestaticfinalStringTRACE_LEVEL_PREFIX =LEVEL_PREFIX +"TRACE" +LEVEL_SUFFIX; |
30 | | -privatestaticfinalStringWARN_LEVEL_PREFIX =LEVEL_PREFIX +"WARN" +LEVEL_SUFFIX; |
31 | | - |
32 | | -privatefinalJsonschema2PojoTasktask; |
33 | | - |
34 | | -publicAntRuleLogger(Jsonschema2PojoTaskjsonschema2PojoTask) { |
35 | | -this.task =jsonschema2PojoTask; |
36 | | - } |
37 | | - |
38 | | -@Override |
39 | | -publicbooleanisDebugEnabled() { |
40 | | -returntrue; |
41 | | - } |
42 | | - |
43 | | -@Override |
44 | | -publicbooleanisErrorEnabled() { |
45 | | -returntrue; |
46 | | - } |
47 | | - |
48 | | -@Override |
49 | | -publicbooleanisInfoEnabled() { |
50 | | -returntrue; |
51 | | - } |
52 | | - |
53 | | -@Override |
54 | | -publicbooleanisTraceEnabled() { |
55 | | -returntrue; |
56 | | - } |
57 | | - |
58 | | -@Override |
59 | | -publicbooleanisWarnEnabled() { |
60 | | -returntrue; |
61 | | - } |
62 | | - |
63 | | -protectedvoiddoDebug(Stringmsg) { |
64 | | -log(msg,null,Project.MSG_DEBUG,DEBUG_LEVEL_PREFIX); |
65 | | - } |
66 | | - |
67 | | -protectedvoiddoError(Stringmsg,Throwablee) { |
68 | | -log(msg,e,Project.MSG_ERR,ERROR_LEVEL_PREFIX); |
69 | | - } |
70 | | - |
71 | | -protectedvoiddoInfo(Stringmsg) { |
72 | | -log(msg,null,Project.MSG_INFO,INFO_LEVEL_PREFIX); |
73 | | - } |
74 | | - |
75 | | -protectedvoiddoTrace(Stringmsg) { |
76 | | -log(msg,null,Project.MSG_VERBOSE,TRACE_LEVEL_PREFIX); |
77 | | - } |
78 | | - |
79 | | -protectedvoiddoWarn(Stringmsg,Throwablee) { |
80 | | -log(msg,null,Project.MSG_WARN,WARN_LEVEL_PREFIX); |
81 | | - } |
82 | | - |
83 | | -privatevoidlog(Stringmsg,Throwablee,intlevel,StringlevelPrefix) { |
84 | | -if (task !=null &&task.getProject() !=null) { |
85 | | -if(e !=null) { |
86 | | -task.getProject().log(msg,e,level); |
87 | | - }else { |
88 | | -task.getProject().log(msg,level); |
89 | | - } |
90 | | - }else { |
91 | | -System.err.println(levelPrefix +msg); |
92 | | -if(e !=null) { |
93 | | -e.printStackTrace(System.err); |
94 | | - } |
| 24 | +privatestaticfinalStringLEVEL_PREFIX ="["; |
| 25 | +privatestaticfinalStringLEVEL_SUFFIX ="] "; |
| 26 | +privatestaticfinalStringDEBUG_LEVEL_PREFIX =LEVEL_PREFIX +"DEBUG" +LEVEL_SUFFIX; |
| 27 | +privatestaticfinalStringERROR_LEVEL_PREFIX =LEVEL_PREFIX +"ERROR" +LEVEL_SUFFIX; |
| 28 | +privatestaticfinalStringINFO_LEVEL_PREFIX =LEVEL_PREFIX +"INFO" +LEVEL_SUFFIX; |
| 29 | +privatestaticfinalStringTRACE_LEVEL_PREFIX =LEVEL_PREFIX +"TRACE" +LEVEL_SUFFIX; |
| 30 | +privatestaticfinalStringWARN_LEVEL_PREFIX =LEVEL_PREFIX +"WARN" +LEVEL_SUFFIX; |
| 31 | + |
| 32 | +privatefinalJsonschema2PojoTasktask; |
| 33 | + |
| 34 | +publicAntRuleLogger(Jsonschema2PojoTaskjsonschema2PojoTask) { |
| 35 | +this.task =jsonschema2PojoTask; |
| 36 | + } |
| 37 | + |
| 38 | +@Override |
| 39 | +publicbooleanisDebugEnabled() { |
| 40 | +returntrue; |
| 41 | + } |
| 42 | + |
| 43 | +@Override |
| 44 | +publicbooleanisErrorEnabled() { |
| 45 | +returntrue; |
| 46 | + } |
| 47 | + |
| 48 | +@Override |
| 49 | +publicbooleanisInfoEnabled() { |
| 50 | +returntrue; |
| 51 | + } |
| 52 | + |
| 53 | +@Override |
| 54 | +publicbooleanisTraceEnabled() { |
| 55 | +returntrue; |
| 56 | + } |
| 57 | + |
| 58 | +@Override |
| 59 | +publicbooleanisWarnEnabled() { |
| 60 | +returntrue; |
| 61 | + } |
| 62 | + |
| 63 | +protectedvoiddoDebug(Stringmsg) { |
| 64 | +log(msg,null,Project.MSG_DEBUG,DEBUG_LEVEL_PREFIX); |
| 65 | + } |
| 66 | + |
| 67 | +protectedvoiddoError(Stringmsg,Throwablee) { |
| 68 | +log(msg,e,Project.MSG_ERR,ERROR_LEVEL_PREFIX); |
| 69 | + } |
| 70 | + |
| 71 | +protectedvoiddoInfo(Stringmsg) { |
| 72 | +log(msg,null,Project.MSG_INFO,INFO_LEVEL_PREFIX); |
| 73 | + } |
| 74 | + |
| 75 | +protectedvoiddoTrace(Stringmsg) { |
| 76 | +log(msg,null,Project.MSG_VERBOSE,TRACE_LEVEL_PREFIX); |
| 77 | + } |
| 78 | + |
| 79 | +protectedvoiddoWarn(Stringmsg,Throwablee) { |
| 80 | +log(msg,null,Project.MSG_WARN,WARN_LEVEL_PREFIX); |
| 81 | + } |
| 82 | + |
| 83 | +privatevoidlog(Stringmsg,Throwablee,intlevel,StringlevelPrefix) { |
| 84 | +if (task !=null &&task.getProject() !=null) { |
| 85 | +if (e !=null) { |
| 86 | +task.getProject().log(msg,e,level); |
| 87 | + }else { |
| 88 | +task.getProject().log(msg,level); |
| 89 | + } |
| 90 | + }else { |
| 91 | +System.err.println(levelPrefix +msg); |
| 92 | +if (e !=null) { |
| 93 | +e.printStackTrace(System.err); |
| 94 | + } |
| 95 | + } |
95 | 96 | } |
96 | | - } |
97 | 97 | } |