01: package org.enhydra.dm.loggers;
02:
03: import org.enhydra.dm.api.loggers.Log;
04:
05: import com.lutris.appserver.server.Enhydra;
06: import com.lutris.logging.LogChannel;
07: import com.lutris.logging.Logger;
08:
09: /**
10: * Enhydra Log extension for abstract Log class.
11: *
12: * @author Svjetlana Milidrag
13: */
14:
15: public class EnhydraLog extends Log {
16: LogChannel logChanel;
17:
18: protected void logMessage(int level, String message) {
19: if (null == logChanel) {
20: logChanel = Enhydra.getApplication().getLogChannel();
21: }
22:
23: if (null != logChanel) {
24:
25: logChanel.write(mapLevels(level), message);
26: }
27:
28: }
29:
30: private int mapLevels(int level) {
31: int lev;
32: switch (level) {
33: case DEBUG:
34: lev = Logger.DEBUG;
35: break;
36: case INFORMATION:
37: lev = Logger.INFO;
38: break;
39: case WARNING:
40: lev = Logger.WARNING;
41: break;
42: case ERROR:
43: lev = Logger.ERROR;
44: break;
45: case CRITICAL:
46: lev = Logger.CRITICAL;
47: break;
48: default:
49: lev = Logger.DEBUG;
50: }
51: return lev;
52: }
53:
54: }
|