01: package net.sourceforge.orbroker.velocity;
02:
03: import java.util.logging.Level;
04: import net.sourceforge.orbroker.Broker;
05:
06: import org.apache.velocity.runtime.RuntimeServices;
07: import org.apache.velocity.runtime.log.LogSystem;
08:
09: /**
10: * Wrapper for Velocity logging.
11: * @author Nils Kilden-Pedersen
12: */
13: public class LogWrapper implements LogSystem {
14:
15: private static final Level[] logLevels = new Level[4];
16: static {
17: logLevels[LogSystem.DEBUG_ID] = Level.FINEST;
18: logLevels[LogSystem.INFO_ID] = Level.FINER;
19: logLevels[LogSystem.WARN_ID] = Level.WARNING;
20: logLevels[LogSystem.ERROR_ID] = Level.SEVERE;
21: }
22:
23: /**
24: * @see org.apache.velocity.runtime.log.LogSystem#init(org.apache.velocity.runtime.RuntimeServices)
25: */
26: public void init(RuntimeServices rs) throws Exception {
27: return;
28: }
29:
30: /**
31: * @see org.apache.velocity.runtime.log.LogSystem#logVelocityMessage(int,
32: * java.lang.String)
33: */
34: public void logVelocityMessage(int level, String message) {
35: Broker.log(logLevels[level], message);
36: }
37: }
|