courselog
Class DebugLogger

java.lang.Object
  extended by courselog.DebugLogger

public class DebugLogger
extends java.lang.Object

Traces debugging in a TextArea and in System.out under Windows.


Field Summary
protected  ewe.io.FileWriter fLog
          Output log file.
 boolean ISCONTROLENABLED
          Configure the debug logger with a control.
 boolean ISFILEENABLED
          Configure the debug logger with a file.
protected  boolean isFreezed
          Freezed state.
protected  ewe.ui.Control logControl
          scrolling control where items are displayed.
 java.lang.String LOGFILE
          Dump file name.
protected  ewe.ui.mTextPad logPad
          Textpad where items are displayed.
protected  java.lang.String stLogContent
          logContent.
 
Constructor Summary
DebugLogger()
          New instance of debuglogger.
 
Method Summary
 void addExceptionToLog(java.lang.Exception exL)
          Log an exception to the log file.
 void addToLog(java.lang.String msg)
          Adds a string at the end of the log and displays the last line.
protected  int countLines(java.lang.String st)
          Count the number of '\n' in a string to know the number of lines.
 void freezeLog()
          Freeze log refreshing to reduce 'real-time' disturbance.
 ewe.ui.Control getLogControl()
          Return the display control to any form that wants to display the logger.
 boolean isLogFreezed()
          Test log refreshing state.
 void setLog(java.lang.String msg)
          Set the log to the message, erasing previous content.
 void unFreezeLog()
          Remove Freezed log refreshing to allow 'real-time' logging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ISCONTROLENABLED

public final boolean ISCONTROLENABLED
Configure the debug logger with a control.

See Also:
Constant Field Values

ISFILEENABLED

public final boolean ISFILEENABLED
Configure the debug logger with a file.

See Also:
Constant Field Values

LOGFILE

public final java.lang.String LOGFILE
Dump file name.

See Also:
Constant Field Values

logPad

protected ewe.ui.mTextPad logPad
Textpad where items are displayed.


logControl

protected ewe.ui.Control logControl
scrolling control where items are displayed.


stLogContent

protected java.lang.String stLogContent
logContent.


isFreezed

protected boolean isFreezed
Freezed state.


fLog

protected ewe.io.FileWriter fLog
Output log file.

Constructor Detail

DebugLogger

public DebugLogger()
New instance of debuglogger. Provides the textpad.

Method Detail

getLogControl

public ewe.ui.Control getLogControl()
Return the display control to any form that wants to display the logger.

Returns:
logControl reference.

addExceptionToLog

public void addExceptionToLog(java.lang.Exception exL)
Log an exception to the log file.

Parameters:
ex - Exception to log, with the stack trace.

addToLog

public void addToLog(java.lang.String msg)
Adds a string at the end of the log and displays the last line. Also sleeps 1s if called in a Thread to allow the user to see the display.

Parameters:
msg - Message to display. May contain '\n' characters.

setLog

public void setLog(java.lang.String msg)
Set the log to the message, erasing previous content.

Parameters:
msg - Message to display, may be multi-line using '\n' character.

freezeLog

public void freezeLog()
Freeze log refreshing to reduce 'real-time' disturbance.


unFreezeLog

public void unFreezeLog()
Remove Freezed log refreshing to allow 'real-time' logging.


isLogFreezed

public boolean isLogFreezed()
Test log refreshing state.


countLines

protected int countLines(java.lang.String st)
Count the number of '\n' in a string to know the number of lines. Used to set the textpad at its last line.

Parameters:
st - String where number of lines must be counted.
Returns:
Number of lines in the string.