PenProfile 2.x

com.livescribe.penlet
Class Logger

java.lang.Object
  extended by com.livescribe.penlet.Logger

public class Logger
extends Object

Logger provides methods to log application messages. The following are the various log levels supported.

An instance of Logger is automatically created for every Penlet implementation and can be got from Penlet.logger. If the penlet has specified Penlet.LOG_MASK_PROPERTY in its application config file, then that is used as the mask for the Penlet.logger or else the DEFAULT_MASK is used.


Field Summary
static short DEFAULT_MASK
          Default mask that has all the mask turned on.
protected  short mask
           
static short MASK_DEBUG
          Debug mask.
static short MASK_INFO
          Information mask.
static short MASK_TEST
          Test mask.
static short MASK_WARN
          Warning mask.
 
Constructor Summary
protected Logger(String name, PrintStream stream, short mask)
          Construct a Logger instance.
 
Method Summary
 void debug(String msg)
          Log the msg on the log stream if debug level is enabled.
 void error(String msg)
          Log the msg on the log stream always.
 void info(String msg)
          Log the msg on the log stream if info level is enabled.
 void setMask(short mask)
          Set the log level mask.
 void test(String msg)
          Sends the msg to the test agent on the pen if test level is enabled.
 void warn(String msg)
          Log the msg on the log stream if warning level is enabled.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MASK_DEBUG

public static final short MASK_DEBUG
Debug mask.

See Also:
setMask(short), Constant Field Values

MASK_INFO

public static final short MASK_INFO
Information mask.

See Also:
setMask(short), Constant Field Values

MASK_WARN

public static final short MASK_WARN
Warning mask.

See Also:
setMask(short), Constant Field Values

MASK_TEST

public static final short MASK_TEST
Test mask. If enabled then test(String) will send the message to the test agent.

See Also:
setMask(short), Constant Field Values

DEFAULT_MASK

public static final short DEFAULT_MASK
Default mask that has all the mask turned on.

See Also:
setMask(short), Constant Field Values

mask

protected short mask
Constructor Detail

Logger

protected Logger(String name,
                 PrintStream stream,
                 short mask)
Construct a Logger instance.

Parameters:
name - name for the logger instance. This should be a non-null value.
stream - print stream where the log messages should be output.This should be a non-null value.
mask - to enable/disable log levels.
Method Detail

setMask

public void setMask(short mask)
Set the log level mask.

Parameters:
mask - log level mask.
See Also:
MASK_DEBUG, MASK_INFO, MASK_TEST, MASK_WARN

debug

public void debug(String msg)
Log the msg on the log stream if debug level is enabled.

Parameters:
msg - log message

info

public void info(String msg)
Log the msg on the log stream if info level is enabled.

Parameters:
msg - log message

warn

public void warn(String msg)
Log the msg on the log stream if warning level is enabled.

Parameters:
msg - the log message

error

public void error(String msg)
Log the msg on the log stream always.

Parameters:
msg - log message

test

public void test(String msg)
Sends the msg to the test agent on the pen if test level is enabled.

Parameters:
msg - log message

PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.