com.groovemanager.core
Class Log

java.lang.Object
  extended by com.groovemanager.core.Log

public class Log
extends java.lang.Object

This class is used for logging. It allows time measurement and different types of logging destinations

Author:
Manu Robledo

Field Summary
static boolean active
          Is logging active?
static int MODE_OFF
          Possible Mode values for logging output
static int MODE_SYSOUT
          Possible Mode values for logging output
private static boolean nanoChecked
          Has the check for the nanoMethod already been done?
private static java.lang.reflect.Method nanoMethod
          The method to invoke when using PROFILE_MODE_NANO.
private static java.lang.Class[] NO_PARAMETERS
          Zero-length Class-Array to use for Reflection calls
static int outputMode
          Mode for logging output
static int PROFILE_MODE_MILLI
          Possible Mode values for the profile time value
static int PROFILE_MODE_NANO
          Possible Mode values for the profile time value
static int PROFILE_MODE_OFF
          Possible Mode values for the profile time value
static int profileMode
          Mode for profilying
static int TYPE_ALL
          Possible message types
static int TYPE_DEBUG
          Possible message types
static int TYPE_ERROR
          Possible message types
static int TYPE_MESSAGE
          Possible message types
static int TYPE_PROFILE
          Possible message types
static int TYPE_WARNING
          Possible message types
static int types
          Message types to which should be reacted
 
Constructor Summary
Log()
           
 
Method Summary
protected static java.lang.String getProfile()
          Get a profile String which tells the current time depending on the selected profile mode.
static void log(java.lang.String s)
          Log a message of unspecified type (will always be logged if logging is active).
static void log(java.lang.String message, int type)
          Log a message of a specific type
private static void nanoCheck()
          Search for the method to invoke when using PROFILE_MODE_NANO
private static long pseudoNano()
          Pseudo method as replacement for System.nanoTime() for compatibility to 1.4
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

active

public static boolean active
Is logging active?


MODE_OFF

public static final int MODE_OFF
Possible Mode values for logging output

See Also:
Constant Field Values

MODE_SYSOUT

public static final int MODE_SYSOUT
Possible Mode values for logging output

See Also:
Constant Field Values

nanoChecked

private static boolean nanoChecked
Has the check for the nanoMethod already been done?


nanoMethod

private static java.lang.reflect.Method nanoMethod
The method to invoke when using PROFILE_MODE_NANO. For compatibility to 1.4 this has to be done via Reflection


NO_PARAMETERS

private static final java.lang.Class[] NO_PARAMETERS
Zero-length Class-Array to use for Reflection calls


outputMode

public static int outputMode
Mode for logging output


PROFILE_MODE_MILLI

public static final int PROFILE_MODE_MILLI
Possible Mode values for the profile time value

See Also:
Constant Field Values

PROFILE_MODE_NANO

public static final int PROFILE_MODE_NANO
Possible Mode values for the profile time value

See Also:
Constant Field Values

PROFILE_MODE_OFF

public static final int PROFILE_MODE_OFF
Possible Mode values for the profile time value

See Also:
Constant Field Values

profileMode

public static int profileMode
Mode for profilying


TYPE_ALL

public static final int TYPE_ALL
Possible message types

See Also:
Constant Field Values

TYPE_DEBUG

public static final int TYPE_DEBUG
Possible message types

See Also:
Constant Field Values

TYPE_ERROR

public static final int TYPE_ERROR
Possible message types

See Also:
Constant Field Values

TYPE_MESSAGE

public static final int TYPE_MESSAGE
Possible message types

See Also:
Constant Field Values

TYPE_PROFILE

public static final int TYPE_PROFILE
Possible message types

See Also:
Constant Field Values

TYPE_WARNING

public static final int TYPE_WARNING
Possible message types

See Also:
Constant Field Values

types

public static int types
Message types to which should be reacted

Constructor Detail

Log

public Log()
Method Detail

getProfile

protected static java.lang.String getProfile()
Get a profile String which tells the current time depending on the selected profile mode. The returned String should be formatted in a way that the user can clearly see the seconds

Returns:
A fromatted String representing the time at which this method was invoked

log

public static void log(java.lang.String s)
Log a message of unspecified type (will always be logged if logging is active). Specifying a type is always better.

Parameters:
s - The message

log

public static void log(java.lang.String message,
                       int type)
Log a message of a specific type

Parameters:
message - The message
type - Type of the message

nanoCheck

private static void nanoCheck()
Search for the method to invoke when using PROFILE_MODE_NANO


pseudoNano

private static long pseudoNano()
Pseudo method as replacement for System.nanoTime() for compatibility to 1.4

Returns:
The current nanoTime derived from System.currentTimeMillis()