amber.utility
Class Log

java.lang.Object
  |
  +--amber.utility.Log
All Implemented Interfaces:
java.io.Serializable

public class Log
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
protected  java.io.FileWriter logFile
          This is the file to log to.
static int LoggingDebug
           
static int LoggingHigh
           
static int LoggingLow
           
static int LoggingMedium
           
static int LoggingOff
          The level of logging
static int LoggingVerbose
           
protected  int logLevel
          This is the level of logging.
protected  java.io.PrintWriter logPrinter
          This is the PrintWriter object derived from the log FileWriter.
 
Constructor Summary
Log()
          Default Constructor.
Log(java.io.FileWriter logFile, int logLevel)
          Initialising Constructor.
 
Method Summary
 java.io.FileWriter getLogFile()
          Gets the data in the following variable: This is the file to log to.
 int getLogLevel()
          Gets the data in the following variable: This is the level of logging.
 java.io.PrintWriter getLogPrinter()
          Gets the data in the following variable: This is the file printer to log to.
 boolean isLogToConsole()
          Returns the state of the console logging.
 void logException(int level, java.lang.Exception ex)
          This function logs an exception to the specified file.
 void logException(int level, java.lang.String message, java.lang.Exception ex)
          This function logs an exception to the specified file.
 void logString(int level, java.lang.String logLine)
          This function logs a string to the specified file.
 void setLogFile(java.io.FileWriter data)
          Sets the data in the following variable: This is the file to log to.
 void setLogLevel(int data)
          Sets the data in the following variable: This is the level of logging.
 void setLogToConsole(boolean state)
          Sets the log object to log to the console as well as the log file.
 java.lang.String toString()
          This function returns the String form of the data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LoggingOff

public static final int LoggingOff
The level of logging

LoggingLow

public static final int LoggingLow

LoggingMedium

public static final int LoggingMedium

LoggingHigh

public static final int LoggingHigh

LoggingDebug

public static final int LoggingDebug

LoggingVerbose

public static final int LoggingVerbose

logFile

protected java.io.FileWriter logFile
This is the file to log to.

logPrinter

protected java.io.PrintWriter logPrinter
This is the PrintWriter object derived from the log FileWriter.

logLevel

protected int logLevel
This is the level of logging. Levels above this will not be logged.
Constructor Detail

Log

public Log()
Default Constructor.

Log

public Log(java.io.FileWriter logFile,
           int logLevel)
Initialising Constructor.
Parameters:
logFile - This is the file to log to.
logLevel - This is the level of logging. Levels below this will not be logged.
Method Detail

logString

public void logString(int level,
                      java.lang.String logLine)
This function logs a string to the specified file. The level determines if the string actually makes it to the log.
Parameters:
level - int containing the level of logging.
logLine - String containing the line to send to the log.

logException

public void logException(int level,
                         java.lang.String message,
                         java.lang.Exception ex)
This function logs an exception to the specified file. The level determines if the string actually makes it to the log.
Parameters:
level - int containing the level of logging.
messge - String message which is printed before the exception.
ex - Exception to send to the log.

logException

public void logException(int level,
                         java.lang.Exception ex)
This function logs an exception to the specified file. The level determines if the string actually makes it to the log.
Parameters:
level - int containing the level of logging.
ex - Exception to send to the log.

getLogFile

public java.io.FileWriter getLogFile()
Gets the data in the following variable: This is the file to log to.
Returns:
FileWriter containing the required information.

getLogPrinter

public java.io.PrintWriter getLogPrinter()
Gets the data in the following variable: This is the file printer to log to.
Returns:
PrintWriter containing the required information.

getLogLevel

public int getLogLevel()
Gets the data in the following variable: This is the level of logging. Levels below this will not be logged.
Returns:
int containing the required information.

isLogToConsole

public boolean isLogToConsole()
Returns the state of the console logging.
Returns:
boolean state of this condition. true is log to the error stream of the console.

setLogToConsole

public void setLogToConsole(boolean state)
Sets the log object to log to the console as well as the log file.
Parameters:
state - boolean state of this condition. true is log to the error stream of the console.

setLogFile

public void setLogFile(java.io.FileWriter data)
Sets the data in the following variable: This is the file to log to. This closes any open log files.
Parameters:
data - FileWriter containing the data to set the variable to.

setLogLevel

public void setLogLevel(int data)
Sets the data in the following variable: This is the level of logging. Levels below this will not be logged.
Parameters:
data - int containing the data to set the variable to.

toString

public java.lang.String toString()
This function returns the String form of the data.
Overrides:
toString in class java.lang.Object
Returns:
String containing the string version of this class.


Copyright © 2002 Clearfield Research Ltd. All Rights Reserved.