|
Logger |
|
/*
** Houston - Status and Logging Toolkit
** Copyright (c) 2001, 2002, 2003 by Gerald Bauer
**
** This program is free software.
**
** You may redistribute it and/or modify it under the terms of the GNU
** General Public License as published by the Free Software Foundation.
** Version 2 of the license should be included with this distribution in
** the file LICENSE, as well as License.html. If the license is not
** included with this distribution, you may find a copy at the FSF web
** site at 'www.gnu.org' or 'www.fsf.org', or you may write to the
** Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139 USA.
**
** THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND,
** NOT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR
** OF THIS SOFTWARE, ASSUMES _NO_ RESPONSIBILITY FOR ANY
** CONSEQUENCE RESULTING FROM THE USE, MODIFICATION, OR
** REDISTRIBUTION OF THIS SOFTWARE.
**
*/
package houston;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class Logger
{
Log _logger;
private Logger( Log logger )
{
_logger = logger;
}
public static Logger getLogger( Class clazz )
{
return new Logger( LogFactory.getLog( clazz ) );
}
public static Logger getLogger( String name )
{
return new Logger( LogFactory.getLog( name ) );
}
public void config( String msg )
{
_logger.info( msg );
}
public void debug( String msg )
{
_logger.debug( msg );
}
public void entering( String method )
{
_logger.trace( "entering " + method + "()" );
}
public void entering( String method, String arg1 )
{
_logger.trace( "entering " + method + "( " + arg1 + " )" );
}
public void error( String msg )
{
_logger.error( msg );
}
public void exiting( String method )
{
_logger.trace( "exiting " + method + "()" );
}
public void exiting( String method, String result )
{
_logger.trace( "exiting " + method + "()=" + result );
}
public void fatal( String msg )
{
_logger.fatal( msg );
}
public void hint( String msg )
{
_logger.info( msg );
}
public void info( String msg )
{
_logger.info( msg );
}
public void trace( String msg )
{
_logger.trace( msg );
}
public void warning( String msg )
{
// todo: use warn instead of warning?
// note: also change StatusListener interface if it happens
_logger.warn( msg );
}
}
/*
* old logger using Java 1.4 built-in Logging toolkit instead of Jakarta Commons Logging Toolkit
* public class Logger
* {
* java.util.logging.Logger _logger;
* private Logger( java.util.logging.Logger logger )
* {
* _logger = logger;
* }
* public static Logger getLogger( Class clazz )
* {
* return new Logger( java.util.logging.Logger.getLogger( clazz.getName() ) );
* }
* public static Logger getLogger( String name )
* {
* return new Logger( java.util.logging.Logger.getLogger( name ) );
* }
* public void fatal( String msg )
* {
* _logger.severe( msg );
* }
* public void error( String msg )
* {
* _logger.severe( msg );
* }
* public void warning( String msg )
* {
* / todo: use warn instead of warning?
* / note: also change StatusListener interface if it happens
* _logger.warning( msg );
* }
* public void info( String msg )
* {
* _logger.info( msg );
* }
* public void hint( String msg )
* {
* _logger.info( msg );
* }
* public void config( String msg )
* {
* _logger.info( msg );
* }
* public void debug( String msg )
* {
* _logger.fine( msg );
* }
* public void trace( String msg )
* {
* _logger.finer( msg );
* }
* public void entering( String method )
* {
* trace( "entering " + method + "()" );
* }
* public void entering( String method, String arg1 )
* {
* trace( "entering " + method + "( " + arg1 + " )" );
* }
* public void exiting( String method )
* {
* trace( "exiting " + method + "()" );
* }
* public void exiting( String method, String result )
* {
* trace( "exiting " + method + "()=" + result );
* }
* }
*/
|
Logger |
|