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 private GraphEnvironment environment = null;
23
24 public VelocityLogger(GraphEnvironment environment)
25 {
26 this.environment = environment;
27 this.debugEnabled = environment.getConfig().isDebug();
28 }
29
30 public void init(RuntimeServices arg0) throws Exception
31 {
32
33 }
34
35 public void logVelocityMessage(int arg0, String arg1)
36 {
37 if (environment != null)
38 {
39 if(arg0 >= ERROR_ID || debugEnabled)
40 {
41 environment.log(arg1);
42 }
43 }
44 }
45
46 public GraphEnvironment getEnvironment()
47 {
48 return environment;
49 }
50
51 public void setEnvironment(GraphEnvironment environment)
52 {
53 this.environment = environment;
54 }
55
56 }