01: /*
02: ** Houston - Status and Logging Toolkit
03: ** Copyright (c) 2001, 2002, 2003 by Gerald Bauer
04: **
05: ** This program is free software.
06: **
07: ** You may redistribute it and/or modify it under the terms of the GNU
08: ** Lesser General Public License as published by the Free Software Foundation.
09: ** Version 2.1 of the license should be included with this distribution in
10: ** the file LICENSE, as well as License.html. If the license is not
11: ** included with this distribution, you may find a copy at the FSF web
12: ** site at 'www.gnu.org' or 'www.fsf.org', or you may write to the
13: ** Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139 USA.
14: **
15: ** THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND,
16: ** NOT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR
17: ** OF THIS SOFTWARE, ASSUMES _NO_ RESPONSIBILITY FOR ANY
18: ** CONSEQUENCE RESULTING FROM THE USE, MODIFICATION, OR
19: ** REDISTRIBUTION OF THIS SOFTWARE.
20: **
21: */
22:
23: package houston;
24:
25: import org.apache.commons.logging.Log;
26: import org.apache.commons.logging.LogFactory;
27:
28: public class Logger {
29: Log _logger;
30:
31: private Logger(Log logger) {
32: _logger = logger;
33: }
34:
35: public static Logger getLogger(Class clazz) {
36: return new Logger(LogFactory.getLog(clazz));
37: }
38:
39: public static Logger getLogger(String name) {
40: return new Logger(LogFactory.getLog(name));
41: }
42:
43: public void config(String msg) {
44: _logger.info(msg);
45: }
46:
47: public void debug(String msg) {
48: _logger.debug(msg);
49: }
50:
51: public void entering(String method) {
52: _logger.trace("entering " + method + "()");
53: }
54:
55: public void entering(String method, String arg1) {
56: _logger.trace("entering " + method + "( " + arg1 + " )");
57: }
58:
59: public void error(String msg) {
60: _logger.error(msg);
61: }
62:
63: public void exiting(String method) {
64: _logger.trace("exiting " + method + "()");
65: }
66:
67: public void exiting(String method, String result) {
68: _logger.trace("exiting " + method + "()=" + result);
69: }
70:
71: public void fatal(String msg) {
72: _logger.fatal(msg);
73: }
74:
75: public void hint(String msg) {
76: _logger.info(msg);
77: }
78:
79: public void info(String msg) {
80: _logger.info(msg);
81: }
82:
83: public void trace(String msg) {
84: _logger.trace(msg);
85: }
86:
87: public void warning(String msg) {
88: // todo: use warn instead of warning?
89: // note: also change StatusListener interface if it happens
90: _logger.warn(msg);
91: }
92: }
|