com.dexterind.gopigo.utils
Class Debug

java.lang.Object
  extended by com.dexterind.gopigo.utils.Debug

public class Debug
extends java.lang.Object

If the debug mode is ON this class will write the given log into a log file. It's possible to define the log dir. and the log filename from the configuration file.

Author:
marcello

Field Summary
static int CONFIG
          The "config" log level.
private  java.lang.Boolean debug
          The flag to set to enable or disable the debug.
private  java.util.logging.FileHandler fh
          The log file handler.
static int FINE
          The "fine" log level.
static int FINER
          The "finer" log level.
static int FINEST
          The "finest" log level.
static int INFO
          The "info" log level.
private  java.lang.String logDir
          The default directory where the log will be created.
private  java.lang.String logFile
          The default filename for the log.
private  java.util.logging.Logger logger
          The logger object.
static int SEVERE
          The "severe" log level.
static int WARNING
          The "warning" log level.
 
Constructor Summary
Debug(java.lang.String target)
           
 
Method Summary
 void log(int level, java.lang.String message)
          Writes the log message with the given level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private java.util.logging.Logger logger
The logger object.


fh

private java.util.logging.FileHandler fh
The log file handler.


FINEST

public static final int FINEST
The "finest" log level.

See Also:
Constant Field Values

FINER

public static final int FINER
The "finer" log level.

See Also:
Constant Field Values

FINE

public static final int FINE
The "fine" log level.

See Also:
Constant Field Values

CONFIG

public static final int CONFIG
The "config" log level.

See Also:
Constant Field Values

INFO

public static final int INFO
The "info" log level.

See Also:
Constant Field Values

WARNING

public static final int WARNING
The "warning" log level.

See Also:
Constant Field Values

SEVERE

public static final int SEVERE
The "severe" log level.

See Also:
Constant Field Values

debug

private java.lang.Boolean debug
The flag to set to enable or disable the debug.


logDir

private java.lang.String logDir
The default directory where the log will be created.


logFile

private java.lang.String logFile
The default filename for the log.

Constructor Detail

Debug

public Debug(java.lang.String target)
Method Detail

log

public void log(int level,
                java.lang.String message)
Writes the log message with the given level. If the debug is disabled then returns immediately.

Parameters:
level - The level of the log to use.
message - The message of the log to write.