01: package org.gomba.utils.servlet;
02:
03: import javax.servlet.http.HttpServlet;
04:
05: /**
06: * Utility class useful for Servlet logging.
07: *
08: * @author Flavio Tordini
09: * @version $Id: ServletLogger.java,v 1.1 2004/11/26 17:52:58 flaviotordini Exp $
10: */
11: public class ServletLogger {
12:
13: private final HttpServlet servlet;
14:
15: private boolean debugMode;
16:
17: /**
18: * @param servlet
19: */
20: public ServletLogger(final HttpServlet servlet, boolean debugMode) {
21: this .servlet = servlet;
22: this .debugMode = debugMode;
23: }
24:
25: public void log(String message, Throwable throwable) {
26: this .servlet.log(message, throwable);
27: }
28:
29: public void log(String message) {
30: this .servlet.log(message);
31: }
32:
33: public boolean isDebugEnabled() {
34: return this .debugMode;
35: }
36:
37: public void debug(String message, Throwable throwable) {
38: if (this .debugMode) {
39: this .servlet.log(message, throwable);
40: }
41: }
42:
43: public void debug(String message) {
44: if (this.debugMode) {
45: this.servlet.log(message);
46: }
47: }
48:
49: }
|