jMobileCore toolkit

com.jmobilecore.support
Class Logger

java.lang.Object
  extended by com.jmobilecore.support.Logger

public class Logger
extends java.lang.Object

Logs messages to the system output stream.

All methods are wrapped in Debug.ON checks; If Debug.ON is false then all methods simply return doing nothing. However, for optimizaton purpose all calles should be wrapped into Debug.ON checks Example:


  if ( Debug.ON ) {
    Logger.development( "Some message" );
  }
 
or:

  if ( Debug.ON ) {
    Logger.OUTPUT_ON = false;
    System.err.println( Logger.development( "Some message" ) );
  }
 

Author:
Greg Gridin

Field Summary
protected static java.lang.String DEVELOPMENT
          Development indicator
protected static java.lang.String EXCEPTION
          Exception indicator
static boolean OUTPUT_ON
          Enables or disables output to standard output stream
protected static java.lang.String SEPARATOR
          Separator for the message
static boolean SEVERITY_ON
          Enables or disables output of severity
static boolean STACK_TRACE_ON
          Enables or disables output of stack trace
protected static java.lang.String TABULATION
          Tabulation for message alighment
static boolean TIME_ON
          Enables or disables output of time
 
Method Summary
static java.lang.String development(java.lang.String msg)
          Logging of development message.
static java.lang.String development(java.lang.String msg, int tabs)
          Logging of development message.
static java.lang.String exception(java.lang.Throwable throwable)
          Logging of an exception and stack trace.
static java.lang.String exception(java.lang.Throwable throwable, int tabs)
          Logging of an exception and stack trace.
static java.lang.String exception(java.lang.Throwable throwable, java.lang.String msg)
          Logging of an exception and stack trace.
static java.lang.String logMemory(java.lang.String msg)
          Logging of memory message.
protected static java.lang.String logMessage(java.lang.String msg, java.lang.String severity, int tabs)
          Logging of the message, adding the timestamp and severity indicator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEVELOPMENT

protected static final java.lang.String DEVELOPMENT
Development indicator

See Also:
Constant Field Values

EXCEPTION

protected static final java.lang.String EXCEPTION
Exception indicator

See Also:
Constant Field Values

OUTPUT_ON

public static boolean OUTPUT_ON
Enables or disables output to standard output stream


SEPARATOR

protected static final java.lang.String SEPARATOR
Separator for the message

See Also:
Constant Field Values

SEVERITY_ON

public static boolean SEVERITY_ON
Enables or disables output of severity


STACK_TRACE_ON

public static boolean STACK_TRACE_ON
Enables or disables output of stack trace


TABULATION

protected static final java.lang.String TABULATION
Tabulation for message alighment

See Also:
Constant Field Values

TIME_ON

public static boolean TIME_ON
Enables or disables output of time

Method Detail

development

public static final java.lang.String development(java.lang.String msg)
Logging of development message.

Parameters:
msg - the logging message.
Returns:
the logging message

development

public static final java.lang.String development(java.lang.String msg,
                                                 int tabs)
Logging of development message.

Parameters:
msg - the logging message.
Returns:
the logging message

exception

public static final java.lang.String exception(java.lang.Throwable throwable)
Logging of an exception and stack trace.

Parameters:
throwable - the exception
Returns:
the logging message
See Also:
exception(Throwable throwable, int tabs)

exception

public static final java.lang.String exception(java.lang.Throwable throwable,
                                               int tabs)
Logging of an exception and stack trace.

Parameters:
throwable - the exception
tabs - the number of tabulations for the message alignment
Returns:
the logging message

exception

public static final java.lang.String exception(java.lang.Throwable throwable,
                                               java.lang.String msg)
Logging of an exception and stack trace.

Parameters:
throwable - the exception
msg - the additional message
Returns:
the logging message

logMemory

public static java.lang.String logMemory(java.lang.String msg)
Logging of memory message.

Parameters:
msg - the additional message
Returns:
the logging message

logMessage

protected static final java.lang.String logMessage(java.lang.String msg,
                                                   java.lang.String severity,
                                                   int tabs)
Logging of the message, adding the timestamp and severity indicator.

Parameters:
msg - the logging message.
severity - the message severity.
tabs - the number of tabulations for the message alignment
Returns:
the logging message

jMobileCore toolkit