com.eventgnosis.util
Class Log

java.lang.Object
  extended bycom.eventgnosis.util.Log

public class Log
extends java.lang.Object

Simple logging class.
Primary features:
   1. Has categories
   2. Can be redirected/turned off ( to DevNull, Stdout, LogFile )


Field Summary
static java.lang.String DEF_HOME_DIR
           
static java.lang.String FILE_SEP
           
static int MAX_RECORDED_ERRS
           
static int TO_LOGFILE
           
static java.lang.String TO_LOGFILE_LBL
           
static int TO_NULL
           
static java.lang.String TO_NULL_LBL
           
static int TO_STDOUT
           
static java.lang.String TO_STDOUT_LBL
           
 
Constructor Summary
Log(java.lang.String homeDir)
          Creates a new instance of the Log class and its log file in folder specified by homeDir parameter.
 
Method Summary
 int charToMode(char c)
           
 void err(java.lang.String str)
          Log the str parameter to the error out.
 void flush()
          Flushes the log.
 java.util.ArrayList getErrorList()
          Returns a list of accumulated errors since last call of this method.
 com.eventgnosis.util.Log.LogFunctor getFunctor(int mode, java.lang.String pre, java.util.List list)
           
 java.lang.String getLogFileName()
          Full path of the log file name.
 java.util.ArrayList getWarningList()
          Returns a list of accumulated warnings since last call of this method.
 void info(java.lang.String str)
          Log the str parameter to info out.
static void main(java.lang.String[] args)
           
 void setModes(int eCtrl, int wCtrl, int iCtrl)
          Specifies log's out for each particular type of message (error, warning and info).
(0=DevNull, 1=Stdout, 2=LogFile )
 void setModes(java.lang.String ctrl)
          Specifies outs for each particular type of message (error, warning and info), by log modes parameter string.
The log modes string contains err, warn, info parameters respectively.
Example:
"110" means that error and warning messages will be logged to stdout, but info messages to DevNull.
 void shutdown()
          Flushes and closes the log.
 java.lang.String toString()
           
 void warn(java.lang.String str)
          Log the str parameter to warning out.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEF_HOME_DIR

public static java.lang.String DEF_HOME_DIR

FILE_SEP

public static java.lang.String FILE_SEP

MAX_RECORDED_ERRS

public static final int MAX_RECORDED_ERRS
See Also:
Constant Field Values

TO_LOGFILE

public static final int TO_LOGFILE
See Also:
Constant Field Values

TO_LOGFILE_LBL

public static final java.lang.String TO_LOGFILE_LBL
See Also:
Constant Field Values

TO_NULL

public static final int TO_NULL
See Also:
Constant Field Values

TO_NULL_LBL

public static final java.lang.String TO_NULL_LBL
See Also:
Constant Field Values

TO_STDOUT

public static final int TO_STDOUT
See Also:
Constant Field Values

TO_STDOUT_LBL

public static final java.lang.String TO_STDOUT_LBL
See Also:
Constant Field Values
Constructor Detail

Log

public Log(java.lang.String homeDir)
Creates a new instance of the Log class and its log file in folder specified by homeDir parameter.

Parameters:
homeDir - - target directory for logging.
Method Detail

charToMode

public int charToMode(char c)

err

public void err(java.lang.String str)
Log the str parameter to the error out.

Parameters:
str - - string to be logged

flush

public void flush()
Flushes the log.


getErrorList

public java.util.ArrayList getErrorList()
Returns a list of accumulated errors since last call of this method.

Returns:
array list of accumulated errors

getFunctor

public com.eventgnosis.util.Log.LogFunctor getFunctor(int mode,
                                                      java.lang.String pre,
                                                      java.util.List list)

getLogFileName

public java.lang.String getLogFileName()
Full path of the log file name.

Returns:
Full path of the log file name.

getWarningList

public java.util.ArrayList getWarningList()
Returns a list of accumulated warnings since last call of this method.

Returns:
array list of accumulated warnings

info

public void info(java.lang.String str)
Log the str parameter to info out.

Parameters:
str - - string to be logged

main

public static void main(java.lang.String[] args)

setModes

public void setModes(int eCtrl,
                     int wCtrl,
                     int iCtrl)
Specifies log's out for each particular type of message (error, warning and info).
(0=DevNull, 1=Stdout, 2=LogFile )

Parameters:
eCtrl - - error
wCtrl - - warning
iCtrl - - info

setModes

public void setModes(java.lang.String ctrl)
Specifies outs for each particular type of message (error, warning and info), by log modes parameter string.
The log modes string contains err, warn, info parameters respectively.
Example:
"110" means that error and warning messages will be logged to stdout, but info messages to DevNull. (0=DevNull, 1=Stdout, 2=LogFile )

Parameters:
ctrl - - log modes string

shutdown

public void shutdown()
Flushes and closes the log.


toString

public java.lang.String toString()

warn

public void warn(java.lang.String str)
Log the str parameter to warning out.

Parameters:
str - - string to be logged