SSF.OS.OSPFv2.test
Class Logger

java.lang.Object
  |
  +--SSF.OS.OSPFv2.test.Logger

public class Logger
extends java.lang.Object

Provides some methods to write log messages and error messages. This class is used by various other classes from the SSF.OS.OSPFv2.test package.


Field Summary
static byte DEBUG_ALL
          Indicates, that both DEBUG_LOG and DEBUG_ERR are enabled.
static byte DEBUG_ERR
          Indicates, that errors are written to stderr.
static byte DEBUG_LOG
          Indicates, that messages are written to stdout.
static byte DEBUG_NONE
          Indicates, that messages are turned off.
private  byte debugging
          Contains the actual ebugging mode.
private static java.lang.String DEFAULT_LOG_MODE
          This is the default mode for logging.
private  java.lang.String myName
          Name of the Protocol Session, this logger belongs to.
private  SSF.OS.ProtocolSession mySession
          Protocol Session, this logger belongs to.
 
Constructor Summary
Logger(byte mode, SSF.OS.ProtocolSession sess, java.lang.String name)
          Constructor.
 
Method Summary
 void config(com.renesys.raceway.DML.Configuration cfg)
          Configures this Logger, according to the configuration passed to this method.
 void errMessage(java.lang.String info)
          Prints an error message, if debug mode is equal to DEBUG_ERR or DEBUG_ALL.
private  double getSimTime()
          Returns the actual simulation time in seconds.
 void logMessage(java.lang.String info)
          Prints a log message, if debug mode is equal to DEBUG_LOG or DEBUG_ALL.
private  void message(java.io.PrintStream stream, java.lang.String info)
          Used by errMessage and logMessage to print the output.
 void setDebuggingMode(byte mode)
          Sets the debugging mode.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

DEBUG_NONE

public static final byte DEBUG_NONE
Indicates, that messages are turned off.

DEBUG_LOG

public static final byte DEBUG_LOG
Indicates, that messages are written to stdout.

DEBUG_ERR

public static final byte DEBUG_ERR
Indicates, that errors are written to stderr.

DEBUG_ALL

public static final byte DEBUG_ALL
Indicates, that both DEBUG_LOG and DEBUG_ERR are enabled.

DEFAULT_LOG_MODE

private static final java.lang.String DEFAULT_LOG_MODE
This is the default mode for logging. Here: be quiet by default.

debugging

private byte debugging
Contains the actual ebugging mode.

mySession

private SSF.OS.ProtocolSession mySession
Protocol Session, this logger belongs to.

myName

private java.lang.String myName
Name of the Protocol Session, this logger belongs to.
Constructor Detail

Logger

public Logger(byte mode,
              SSF.OS.ProtocolSession sess,
              java.lang.String name)
Constructor.
Parameters:
mode - Specifies the debugging mode. This is one of DEBUG_NONE, DEBUG_LOG DEBUG_ERR or DEBUG_ALL.
sess - A reference to the caller's ProtocolSession.
name - A name, which is displayed in every generated logfile entry.
Method Detail

config

public void config(com.renesys.raceway.DML.Configuration cfg)
            throws com.renesys.raceway.DML.configException
Configures this Logger, according to the configuration passed to this method. The method looks for a single key in this configuration:
debug log|error|all|none
Parameters:
cfg - DML config containing the configuration. Typically the configuration of the calling ProtocolSession

errMessage

public void errMessage(java.lang.String info)
Prints an error message, if debug mode is equal to DEBUG_ERR or DEBUG_ALL.
Parameters:
info - Contains a string with the message for the logfile

logMessage

public void logMessage(java.lang.String info)
Prints a log message, if debug mode is equal to DEBUG_LOG or DEBUG_ALL.
Parameters:
info - Contains a string with the message for the logfile

setDebuggingMode

public void setDebuggingMode(byte mode)
Sets the debugging mode. Valid values are DEBUG_NONE, DEBUG_LOG DEBUG_ERR or DEBUG_ALL.
Parameters:
mode - Debug mode

message

private void message(java.io.PrintStream stream,
                     java.lang.String info)
Used by errMessage and logMessage to print the output.
Parameters:
stream - Specifies a stream to write the message to. Typically this is stdout for log messages and stderr for error messages.
info - The message to print.

getSimTime

private double getSimTime()
Returns the actual simulation time in seconds.