nan.tools
Class EventLogger

java.lang.Object
  extended bynan.tools.EventLogger

public class EventLogger
extends java.lang.Object

Logs messages, errors, and warnings as the program runs.

Version:
1.10, 12/23/03
Author:
John David Ratliff

Field Summary
static java.lang.String ERROR
          The marker for errors.
static java.lang.String MESSAGE
          The marker for messages.
static java.lang.String SEPARATOR
          The separator String.
static java.lang.String WARNING
          The marker for warnings.
 
Method Summary
 void close()
          Closes the event logger.
static EventLogger getInstance()
          Gets the singleton instance of the EventLogger.
static java.lang.String getLogFileName()
          Gets the name of the log file for the current day.
 boolean isReady()
          Asks if the logger is ready.
 void logError(java.lang.String error)
          Logs an error message.
 void logMessage(java.lang.String message)
          Logs a normal message.
 void logWarning(java.lang.String warning)
          Logs a warning.
 void open(java.io.File file)
          Opens the EventLogger on a file.
 java.lang.String toString()
          Returns a String representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MESSAGE

public static final java.lang.String MESSAGE
The marker for messages.

See Also:
Constant Field Values

ERROR

public static final java.lang.String ERROR
The marker for errors.

See Also:
Constant Field Values

WARNING

public static final java.lang.String WARNING
The marker for warnings.

See Also:
Constant Field Values

SEPARATOR

public static final java.lang.String SEPARATOR
The separator String.

See Also:
Constant Field Values
Method Detail

getInstance

public static final EventLogger getInstance()
Gets the singleton instance of the EventLogger.

Returns:
The singleton EventLogger.

getLogFileName

public static java.lang.String getLogFileName()
Gets the name of the log file for the current day.

Returns:
The filename for the log file.

isReady

public boolean isReady()
Asks if the logger is ready.

Returns:
true if the logger is ready; false otherwise.

open

public void open(java.io.File file)
Opens the EventLogger on a file.

Parameters:
file - The name file to post events to.

close

public void close()
Closes the event logger.


logMessage

public void logMessage(java.lang.String message)
                throws NotReadyException
Logs a normal message.

Parameters:
message - The message.
Throws:
NotReadyException - if this logger has not been initialized.

logError

public void logError(java.lang.String error)
              throws NotReadyException
Logs an error message.

Parameters:
error - The error message.
Throws:
NotReadyException - if this logger has not been initialized.

logWarning

public void logWarning(java.lang.String warning)
                throws NotReadyException
Logs a warning.

Parameters:
warning - The warning message.
Throws:
NotReadyException - if this logger has not been initialized.

toString

public java.lang.String toString()
Returns a String representation of this object.

Returns:
A String representation.