planet.simulate
Class Logger

java.lang.Object
  extended byplanet.simulate.Logger

public class Logger
extends java.lang.Object

Author:
Pedro García, Ruben Mondejar, Jordi Pujol

Field Summary
static int ERROR_LOG
          Logger level: Only permits to show error logs.
static int EVENT_LOG
          Logger level: Permits to show event logs.
static int MSG_LOG
          Logger level: The less restrictive level of logs.
static int PRINT_LOG
          Logger level: Permits to show a bigger number of logs.
 
Constructor Summary
Logger()
           
 
Method Summary
static int getStep()
          Gets the actual step in run.
static void log(java.lang.Object obj, java.lang.String msg, java.lang.Object obj2, int lvl)
          Logs the following string: obj + msg + obj2
static void log(java.lang.String[] msgs, java.lang.Object[] objs, int lvl)
          Logs a combination of the arguments.
static void log(java.lang.String msg, int lvl)
          Logs a message msg with level lvl .
static void log(java.lang.String msg, int p1, java.lang.String msg1, int lvl)
          Logs a string combining arguments as following: msg + p1 + msg1
static void log(java.lang.String msg, java.lang.Object obj, int lvl)
          Logs any object.
static void log(java.lang.String msg, java.lang.Object obj, java.lang.String msg2, int lvl)
          Logs the following string: msg + obj + msg2
static void logReceive(Id id, RouteMessage msg, int lvl)
          Logs a received RouteMessage
static void logSend(Id id, RouteMessage msg, int lvl)
          Logs a sent RouteMessage.
static void setLevel(int lvl)
          Sets the level of logs to be applied.
static void setStep(int time)
          Sets the actual step in run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_LOG

public static final int ERROR_LOG
Logger level: Only permits to show error logs.

See Also:
Constant Field Values

EVENT_LOG

public static final int EVENT_LOG
Logger level: Permits to show event logs.

See Also:
Constant Field Values

PRINT_LOG

public static final int PRINT_LOG
Logger level: Permits to show a bigger number of logs.

See Also:
Constant Field Values

MSG_LOG

public static final int MSG_LOG
Logger level: The less restrictive level of logs. It is anticipated that they appear logs of sending and reception of the different messages.

See Also:
Constant Field Values
Constructor Detail

Logger

public Logger()
Method Detail

setLevel

public static void setLevel(int lvl)
Sets the level of logs to be applied.

Parameters:
lvl - Level of logs to apply.

setStep

public static void setStep(int time)
Sets the actual step in run.

Parameters:
time - Actual step in run.

getStep

public static int getStep()
Gets the actual step in run.

Returns:
Actual step in run

log

public static void log(java.lang.String msg,
                       int lvl)
Logs a message msg with level lvl .

Parameters:
msg - Message to be log.
lvl - Priority of the log.

log

public static void log(java.lang.String msg,
                       int p1,
                       java.lang.String msg1,
                       int lvl)
Logs a string combining arguments as following:
    msg + p1 + msg1
 

Parameters:
msg - First fragment of the message.
p1 - int value to be log in second term.
msg1 - Last fragment of the message.
lvl - Priority of the message.

logSend

public static void logSend(Id id,
                           RouteMessage msg,
                           int lvl)
Logs a sent RouteMessage.

Parameters:
id - Related Id for the RouteMessage.
msg - RouteMessage to be log.
lvl - Priority of the message.

logReceive

public static void logReceive(Id id,
                              RouteMessage msg,
                              int lvl)
Logs a received RouteMessage

Parameters:
id - Related Id of the RouteMessage.
msg - RouteMessage to be log.
lvl - Priority of the log.

log

public static void log(java.lang.String msg,
                       java.lang.Object obj,
                       int lvl)
Logs any object.

Parameters:
msg - String to be logged first.
obj - Object to be logged at last (using obj.toString()).
lvl - Priority of the log.

log

public static void log(java.lang.Object obj,
                       java.lang.String msg,
                       java.lang.Object obj2,
                       int lvl)
Logs the following string:
    obj + msg + obj2
 

Parameters:
obj - First object to be logged.
msg - Message to be logged at second term.
obj2 - Last object to be logged.
lvl - Priority of the log.

log

public static void log(java.lang.String msg,
                       java.lang.Object obj,
                       java.lang.String msg2,
                       int lvl)
Logs the following string:
    msg + obj + msg2
 

Parameters:
msg - Message to be logged at first.
obj - Object to be logged at second term.
msg2 - Message to be logged at last.
lvl - Priority of the log.

log

public static void log(java.lang.String[] msgs,
                       java.lang.Object[] objs,
                       int lvl)
Logs a combination of the arguments. That is:
 for (int i = 0; i < msgs.length; i++) {
     result = result + msgs[i] + objs[i];
 }
 
and logs the result string.

Parameters:
msgs - String to be used in combination.
objs - Objects to be used in combination.
lvl - Priority of the log.