peer2me.util
Class Log

java.lang.Object
  extended bypeer2me.util.Log

public class Log
extends java.lang.Object

This class contains functionality to create and maintain a log of events and exceptions. The Log contains four differnet kinds of logs, an exception log, a connection log, a data package log and a debug log. They can be used to log events from anywhere in the framework, and the logs can be retreived later to get information about the execution of the MIDlet.

Author:
Torbjørn Vatn & Steinar A. Hestnes

Field Summary
static int CONNECTION_LOG
           
static int DATA_PACKAGE_LOG
           
static int DEBUG_LOG
           
static int EXCEPTION_LOG
           
 
Method Summary
static Log getInstance()
          This method returns the only existing instance of the Log class
 java.lang.String getLog(int log)
          This method returns the desired log in a displayable format.
 void logConnection(java.lang.String connectionStatus)
          This method adds a Connection entry to the Connection log
 void logDataPackage(java.lang.String packageStatus)
          This method adds a data package entry to the data package log
 void logDebugInfo(java.lang.String location, java.lang.String debugInfo)
          This method adds a Debug entry to the Debug log
 void logException(java.lang.String location, java.lang.Exception exception, boolean notify)
          This method adds an Exception entry to the Exception log
 void setFramework(FrameworkFrontEnd framework)
          This method is called by the FrameworkFrontEnd to reveal itself to the Log
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXCEPTION_LOG

public static final int EXCEPTION_LOG
See Also:
Constant Field Values

CONNECTION_LOG

public static final int CONNECTION_LOG
See Also:
Constant Field Values

DATA_PACKAGE_LOG

public static final int DATA_PACKAGE_LOG
See Also:
Constant Field Values

DEBUG_LOG

public static final int DEBUG_LOG
See Also:
Constant Field Values
Method Detail

getInstance

public static Log getInstance()
This method returns the only existing instance of the Log class

Returns:
The singleton instance of the Log class

setFramework

public void setFramework(FrameworkFrontEnd framework)
This method is called by the FrameworkFrontEnd to reveal itself to the Log

Parameters:
framework - The FrameworkFrontEnd refrence sent by the FrameworkFrontEnd itself

logException

public void logException(java.lang.String location,
                         java.lang.Exception exception,
                         boolean notify)
This method adds an Exception entry to the Exception log

Parameters:
location - The location (class and method) where the Exception occured
exception - The actual Exception
notify - This boolean decides whether or not to notify the Framework about the Exception that occured

logConnection

public void logConnection(java.lang.String connectionStatus)
This method adds a Connection entry to the Connection log

Parameters:
connectionStatus - A textual description of the connection status

logDataPackage

public void logDataPackage(java.lang.String packageStatus)
This method adds a data package entry to the data package log

Parameters:
packageStatus - A textual description of the data package status

logDebugInfo

public void logDebugInfo(java.lang.String location,
                         java.lang.String debugInfo)
This method adds a Debug entry to the Debug log

Parameters:
location - The location (class and method) where the debuginfo was logged
debugInfo - A textual description of the debug information

getLog

public java.lang.String getLog(int log)
This method returns the desired log in a displayable format. It must be called by activating a soft button in the application. Due to multithreading and interuptions there can be some delay in the creation of the log.

Parameters:
log - The Log.FIELD representing the desired log
Returns:
The desired log as a String