com.lightstreamer.javameclient.midp.logger
Class Logger

java.lang.Object
  extended by com.lightstreamer.javameclient.midp.logger.Logger

public class Logger
extends java.lang.Object

Logger class for debug purpose. Writes log lines with a complete date, the logger identification and the logged message. This class writes lines using System.out.println so the log will be not available when running on mobile phones but only on the IDE's console.


Method Summary
 void activate()
          Switch this Logger instance to active (ie lines of log will appear on console)
 void deactivate()
          Switch this Logger instance to non active (ie lines of log will not appear on console)
static Logger getLogger(java.lang.String id)
          Gets a logger from a static repository.
 boolean isActive()
          Gets the actual status of the Logger
 void log(java.lang.String write)
          Writes a line of log (if logger is active)
static void setDefaultActive(boolean active)
          Since Logger instances are not useful in production environments this method permits to activate/deactivate the logging system.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLogger

public static Logger getLogger(java.lang.String id)
Gets a logger from a static repository. If no logger with the specified id is available a new one will be supplied.

Parameters:
id - the id of the requested logger.
Returns:
a Logger instance with the specified id.

setDefaultActive

public static void setDefaultActive(boolean active)
Since Logger instances are not useful in production environments this method permits to activate/deactivate the logging system. Note that each logger can change his setting using the activate() method.

Parameters:
active - true/false to activate/deactivate the logging system
See Also:
deactivate(), isActive()

activate

public void activate()
Switch this Logger instance to active (ie lines of log will appear on console)

See Also:
setDefaultActive(boolean), deactivate(), isActive()

deactivate

public void deactivate()
Switch this Logger instance to non active (ie lines of log will not appear on console)

See Also:
setDefaultActive(boolean), activate(), isActive()

isActive

public boolean isActive()
Gets the actual status of the Logger

Returns:
true/false if Logger is active or not
See Also:
setDefaultActive(boolean), activate(), deactivate()

log

public void log(java.lang.String write)
Writes a line of log (if logger is active)

Parameters:
write - the line of log
See Also:
isActive()