1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.tools.visualizer.util; |
12 | |
|
13 | |
import org.mule.tools.visualizer.config.GraphEnvironment; |
14 | |
|
15 | |
import org.apache.velocity.runtime.RuntimeServices; |
16 | |
import org.apache.velocity.runtime.log.LogSystem; |
17 | |
|
18 | |
public class VelocityLogger implements LogSystem |
19 | |
{ |
20 | |
private final boolean debugEnabled; |
21 | |
|
22 | 12 | private GraphEnvironment environment = null; |
23 | |
|
24 | |
public VelocityLogger(GraphEnvironment environment) |
25 | 12 | { |
26 | 12 | this.environment = environment; |
27 | 12 | this.debugEnabled = environment.getConfig().isDebug(); |
28 | 12 | } |
29 | |
|
30 | |
public void init(RuntimeServices arg0) throws Exception |
31 | |
{ |
32 | |
|
33 | 12 | } |
34 | |
|
35 | |
public void logVelocityMessage(int arg0, String arg1) |
36 | |
{ |
37 | 384 | if (environment != null) |
38 | |
{ |
39 | 384 | if(arg0 >= ERROR_ID || debugEnabled) |
40 | |
{ |
41 | 12 | environment.log(arg1); |
42 | |
} |
43 | |
} |
44 | 384 | } |
45 | |
|
46 | |
public GraphEnvironment getEnvironment() |
47 | |
{ |
48 | 0 | return environment; |
49 | |
} |
50 | |
|
51 | |
public void setEnvironment(GraphEnvironment environment) |
52 | |
{ |
53 | 0 | this.environment = environment; |
54 | 0 | } |
55 | |
|
56 | |
} |