001/* ----------------------------------------------------------------------------
002   The Kiwi Toolkit - A Java Class Library
003   Copyright (C) 1998-2004 Mark A. Lindner
004
005   This library is free software; you can redistribute it and/or
006   modify it under the terms of the GNU General Public License as
007   published by the Free Software Foundation; either version 2 of the
008   License, or (at your option) any later version.
009
010   This library is distributed in the hope that it will be useful,
011   but WITHOUT ANY WARRANTY; without even the implied warranty of
012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013   General Public License for more details.
014
015   You should have received a copy of the GNU General Public License
016   along with this library; if not, write to the Free Software
017   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
018   02111-1307, USA.
019 
020   The author may be contacted at: mark_a_lindner@yahoo.com
021   ----------------------------------------------------------------------------
022   $Log: RawLoggingEndpoint.java,v $
023   Revision 1.5  2004/05/05 21:22:45  markl
024   Comment header updates.
025
026   Revision 1.4  2003/01/19 09:42:39  markl
027   Javadoc & comment header updates.
028
029   Revision 1.3  2001/03/12 03:16:49  markl
030   *** empty log message ***
031
032   Revision 1.2  1999/01/10 03:55:05  markl
033   added GPL header & RCS tag
034   ----------------------------------------------------------------------------
035*/
036
037package kiwi.util;
038
039import java.io.*;
040
041/** An implementation of <code>LoggingEndpoint</code> for standard error.
042  *
043  * @author Mark Lindner
044  */
045
046public class RawLoggingEndpoint implements LoggingEndpoint
047  {
048  private static final String types[]
049    = {"INFO   ", "STATUS ", "WARNING", "ERROR  " };
050
051  /** Construct a new <code>RawLoggingEndpoint</code>.
052    */
053
054  public RawLoggingEndpoint()
055    {
056    }
057  
058  /** Write a message to standard error.
059    *
060    * @param type The message type; one of the constants defined in
061    * <code>LoggingEndpoint</code>.
062    * @param message The message.
063    */
064
065  public void logMessage(int type, String message)
066    {
067    if((type < 0) || (type > 3)) type = 1;
068
069    System.err.println(types[type] + " - " + message);
070    }
071
072  /** Close the logging endpoint. This method is effectively a no-op, since it
073    * is usually undesirable to close the standard error stream.
074    */
075
076  public void close()
077    {
078    }
079  
080  }
081
082/* end of source file */