eu.bootstrep.Utilities
Class Logger

java.lang.Object
  extended by eu.bootstrep.Utilities.Logger

public class Logger
extends java.lang.Object

This Class is responsible for writing log messages to a given printstream. This class is under re-engineering. So far, only log levels 0 and 3, i. e. minimum and maximum have been completely implemented.
Use the void constructor to pass logLevel dinamically to methods, otherwise the maximum level will be used. If You use the Logger(Int) constructor, you set the logLevel at the start of the process.


Field Summary
(package private)  ListBean LB
           
(package private)  Variables LOV
          An instance of Variable Class
 
Constructor Summary
Logger()
          Creates a new instance of Logger log level is read from property file
Logger(java.io.PrintStream out, java.lang.String className)
          Creates a new instance of Logger Class: The loglevel is maximum and overrides the logLevel global value read from property file.
 
Method Summary
static void debugArray(java.io.PrintStream out, java.lang.Integer tab, java.lang.String errCod, java.lang.String[] inputArr, java.lang.String arrayName)
          This method writes debug messages for arrays to PrintStream
static void debugFunction(java.io.PrintStream out, java.lang.Integer tab, java.lang.String errCod, java.lang.String funcName, java.lang.String message)
          This method writes down log messages to a given PrintStream.
This method is called by framework when log level is max (3)
 void debugList(java.io.PrintStream out, java.lang.Integer tabmess, java.lang.Integer tab, java.lang.String errCod, java.lang.Integer opt)
          This method debug lists.
private static java.lang.String getIndentSpaces(int indent)
          This method appends some spaces to the buffer to indent the output
 void logClass(java.io.PrintStream out, java.lang.String className, java.lang.String param)
          This method is used to log only the name of classes used
static void logWrite(java.io.PrintStream out, java.lang.String errCod, java.lang.String strLog)
          This method is called when log level is INFO ( 1 )
 void macroLog(java.io.PrintStream out, java.lang.String operation, java.lang.String date)
          This method writes down only macro steps, i.e.
 java.lang.String[] setMessagesToLog(java.lang.String funcName, java.lang.String tab, java.lang.String Message, java.lang.String errCode, java.lang.String strLog, java.lang.String logCode)
          This method writes log messages.
 void toggleLevel(java.io.PrintStream out, java.lang.Integer logLevel, java.lang.String[] messages)
          This method toggles between different log levels
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOV

Variables LOV
An instance of Variable Class


LB

ListBean LB
Constructor Detail

Logger

public Logger()
Creates a new instance of Logger log level is read from property file


Logger

public Logger(java.io.PrintStream out,
              java.lang.String className)
Creates a new instance of Logger Class: The loglevel is maximum and overrides the logLevel global value read from property file.

Parameters:
className - name of the class
out - The printstream
Method Detail

setMessagesToLog

public java.lang.String[] setMessagesToLog(java.lang.String funcName,
                                           java.lang.String tab,
                                           java.lang.String Message,
                                           java.lang.String errCode,
                                           java.lang.String strLog,
                                           java.lang.String logCode)
This method writes log messages.
This method creates as array whose elements contain log messages. Different elements are used for different lof levels.

Parameters:
logCode - The log level
funcName - The function which call this method
tab - The indentation for the log format
Message - Message to be eritten
errCode - Error code
strLog - A brief log string
Returns:
An array with the whole information about the message to be logged

toggleLevel

public void toggleLevel(java.io.PrintStream out,
                        java.lang.Integer logLevel,
                        java.lang.String[] messages)
This method toggles between different log levels

Parameters:
out - Output PrintStream
logLevel - The level of log: values plan=0,info=1,warning=2,debug=3
messages - An Array to be formatted:
  • element 0 is the indentation;
  • element 1 is the error code;
  • element 2 is the message
  • element 3 is the function to debug

getIndentSpaces

private static java.lang.String getIndentSpaces(int indent)
This method appends some spaces to the buffer to indent the output

Parameters:
indent - Space amount to buffer
Returns:
the space added to buffer

debugFunction

public static void debugFunction(java.io.PrintStream out,
                                 java.lang.Integer tab,
                                 java.lang.String errCod,
                                 java.lang.String funcName,
                                 java.lang.String message)
This method writes down log messages to a given PrintStream.
This method is called by framework when log level is max (3)

Parameters:
out - output printStream
tab - tab is an indentation for output
errCod - code of the error. The value is store in global variables
funcName - The function which is under debug
message - The message to display

logWrite

public static void logWrite(java.io.PrintStream out,
                            java.lang.String errCod,
                            java.lang.String strLog)
This method is called when log level is INFO ( 1 )

Parameters:
out - Output PrintStream
errCod - The code of the error: the value is stored in global variables
strLog - The message to display

debugArray

public static void debugArray(java.io.PrintStream out,
                              java.lang.Integer tab,
                              java.lang.String errCod,
                              java.lang.String[] inputArr,
                              java.lang.String arrayName)
This method writes debug messages for arrays to PrintStream

Parameters:
out - The printstream
tab - The indentation in the log format
errCod - The error code
inputArr - The input Array
arrayName - The name of the input array

logClass

public void logClass(java.io.PrintStream out,
                     java.lang.String className,
                     java.lang.String param)
This method is used to log only the name of classes used

Parameters:
out - PrintStream
className - Class name
param - parameter

macroLog

public void macroLog(java.io.PrintStream out,
                     java.lang.String operation,
                     java.lang.String date)
This method writes down only macro steps, i.e. steps corresponding to methods.
This method is used when log level is 0. Only the flus of the program is logged and no specific details are written down.

Parameters:
out - The PrintStream
operation - The type of operation
date - The date of operation

debugList

public void debugList(java.io.PrintStream out,
                      java.lang.Integer tabmess,
                      java.lang.Integer tab,
                      java.lang.String errCod,
                      java.lang.Integer opt)
This method debug lists. Used when log level is 2

Parameters:
out - The PrintStream
tabmess - The indentation of the message
tab - Another indentation
errCod - the error code
opt - An option to display specific types of lists