KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > houston > Logger


1 /*
2 ** Houston - Status and Logging Toolkit
3 ** Copyright (c) 2001, 2002, 2003 by Gerald Bauer
4 **
5 ** This program is free software.
6 **
7 ** You may redistribute it and/or modify it under the terms of the GNU
8 ** Lesser General Public License as published by the Free Software Foundation.
9 ** 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 {
30    Log _logger;
31
32    private Logger( Log logger )
33    {
34       _logger = logger;
35    }
36
37    public static Logger getLogger( Class JavaDoc clazz )
38    {
39       return new Logger( LogFactory.getLog( clazz ) );
40    }
41
42    public static Logger getLogger( String JavaDoc name )
43    {
44       return new Logger( LogFactory.getLog( name ) );
45    }
46
47    public void config( String JavaDoc msg )
48    {
49       _logger.info( msg );
50    }
51
52    public void debug( String JavaDoc msg )
53    {
54       _logger.debug( msg );
55    }
56
57
58    public void entering( String JavaDoc method )
59    {
60       _logger.trace( "entering " + method + "()" );
61    }
62
63    public void entering( String JavaDoc method, String JavaDoc arg1 )
64    {
65       _logger.trace( "entering " + method + "( " + arg1 + " )" );
66    }
67
68    public void error( String JavaDoc msg )
69    {
70       _logger.error( msg );
71    }
72
73    public void exiting( String JavaDoc method )
74    {
75       _logger.trace( "exiting " + method + "()" );
76    }
77
78    public void exiting( String JavaDoc method, String JavaDoc result )
79    {
80       _logger.trace( "exiting " + method + "()=" + result );
81    }
82
83    public void fatal( String JavaDoc msg )
84    {
85       _logger.fatal( msg );
86    }
87
88    public void hint( String JavaDoc msg )
89    {
90       _logger.info( msg );
91    }
92
93    public void info( String JavaDoc msg )
94    {
95       _logger.info( msg );
96    }
97
98    public void trace( String JavaDoc msg )
99    {
100       _logger.trace( msg );
101    }
102
103    public void warning( String JavaDoc msg )
104    {
105       // todo: use warn instead of warning?
106
// note: also change StatusListener interface if it happens
107
_logger.warn( msg );
108    }
109 }
110
Popular Tags