kiwi.util
Class FileLoggingEndpoint

java.lang.Object
  extended bykiwi.util.FileLoggingEndpoint
All Implemented Interfaces:
LoggingEndpoint

public class FileLoggingEndpoint
extends java.lang.Object
implements LoggingEndpoint

An implementation of LoggingEndpoint for ordinary files.

Author:
Mark Lindner, PING Software Group

Field Summary
private  java.io.BufferedWriter out
           
private static java.lang.String[] types
           
 
Fields inherited from interface kiwi.util.LoggingEndpoint
ERROR, INFO, STATUS, WARNING
 
Constructor Summary
FileLoggingEndpoint(java.lang.String filename)
          Construct a new FileLoggingEndpoint.
 
Method Summary
 void close()
          Close the log file.
 void logMessage(int type, java.lang.String message)
          Write a message to the log file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

types

private static final java.lang.String[] types

out

private java.io.BufferedWriter out
Constructor Detail

FileLoggingEndpoint

public FileLoggingEndpoint(java.lang.String filename)
                    throws java.io.IOException
Construct a new FileLoggingEndpoint.

Parameters:
filename - The name of the file to which log messages will be written.
Throws:
java.io.IOException - If the file could not be opened for writing.
Method Detail

logMessage

public void logMessage(int type,
                       java.lang.String message)
Write a message to the log file.

Specified by:
logMessage in interface LoggingEndpoint
Parameters:
type - The message type; one of the static constants defined in LoggingEndpoint.
message - The message to be written.

close

public void close()
Close the log file. Once the file is closed, this logging endpoint can no longer be used.

Specified by:
close in interface LoggingEndpoint