com.vodafone360.people.utils
Class LogUtils

java.lang.Object
  extended by com.vodafone360.people.utils.LogUtils

public final class LogUtils
extends java.lang.Object

Logging utility functions: Allows logging to be enabled, Logs application name and current thread name prepended to logged data.


Field Summary
private static java.lang.String APP_FILE_NAME
          SD Card filename.
private static java.lang.String APP_NAME_PREFIX
          Application tag prefix for LogCat.
private static java.text.SimpleDateFormat DATE_FORMAT
          Simple date format for Logging.
private static int LOG_FILE_COUNT
          Maximum number of SD Card log files.
private static int LOG_FILE_LIMIT
          SD Card log file size limit (in bytes).
private static java.lang.Boolean mEnabled
          Stores the enabled state of the LogUtils function.
private static java.util.logging.Logger sLogger
          SD Card data logger.
 
Constructor Summary
private LogUtils()
          Private constructor makes it impossible to create an instance of this utility class.
 
Method Summary
static void enableLogcat()
          Enable logging.
static java.lang.Boolean isEnabled()
          Returns if the logging feature is currently enabled.
static void logD(java.lang.String data)
          Write debug log string.
static void logE(java.lang.String data)
          Write error log string.
static void logE(java.lang.String data, java.lang.Throwable exception)
          Write error log string with Exception thrown.
static void logI(java.lang.String data)
          Write info log string.
static void logToFile(byte[] data, java.lang.String fileName)
          Writes a given byte-array to the SD card under the given file name.
static void logToFile(java.lang.String data)
          Write a line to the SD Card log file (e.g.
static void logV(java.lang.String data)
          Write verbose log string.
static void logW(java.lang.String data)
          Write warning log string.
static void logWithName(java.lang.String name, java.lang.String data)
          Write info log string with specific component name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APP_NAME_PREFIX

private static final java.lang.String APP_NAME_PREFIX
Application tag prefix for LogCat.

See Also:
Constant Field Values

DATE_FORMAT

private static final java.text.SimpleDateFormat DATE_FORMAT
Simple date format for Logging.


APP_FILE_NAME

private static final java.lang.String APP_FILE_NAME
SD Card filename.

See Also:
Constant Field Values

LOG_FILE_LIMIT

private static final int LOG_FILE_LIMIT
SD Card log file size limit (in bytes).

See Also:
Constant Field Values

LOG_FILE_COUNT

private static final int LOG_FILE_COUNT
Maximum number of SD Card log files.

See Also:
Constant Field Values

mEnabled

private static java.lang.Boolean mEnabled
Stores the enabled state of the LogUtils function.


sLogger

private static java.util.logging.Logger sLogger
SD Card data logger.

Constructor Detail

LogUtils

private LogUtils()
Private constructor makes it impossible to create an instance of this utility class.

Method Detail

enableLogcat

public static void enableLogcat()
Enable logging.


logI

public static void logI(java.lang.String data)
Write info log string.

Parameters:
data - String containing data to be logged.

logD

public static void logD(java.lang.String data)
Write debug log string.

Parameters:
data - String containing data to be logged.

logW

public static void logW(java.lang.String data)
Write warning log string.

Parameters:
data - String containing data to be logged.

logE

public static void logE(java.lang.String data)
Write error log string.

Parameters:
data - String containing data to be logged.

logV

public static void logV(java.lang.String data)
Write verbose log string.

Parameters:
data - String containing data to be logged.

logWithName

public static void logWithName(java.lang.String name,
                               java.lang.String data)
Write info log string with specific component name.

Parameters:
name - String name string to prepend to log data.
data - String containing data to be logged.

logE

public static void logE(java.lang.String data,
                        java.lang.Throwable exception)
Write error log string with Exception thrown.

Parameters:
data - String containing data to be logged.
exception - Exception associated with error.

logToFile

public static void logToFile(java.lang.String data)
Write a line to the SD Card log file (e.g. "Deleted contact name from NAB because....").

Parameters:
data - String containing data to be logged.

logToFile

public static void logToFile(byte[] data,
                             java.lang.String fileName)
Writes a given byte-array to the SD card under the given file name.

Parameters:
data - The data to write to the SD card.
fileName - The file name to write the data under.

isEnabled

public static java.lang.Boolean isEnabled()
Returns if the logging feature is currently enabled.

Returns:
TRUE if logging is enabled, FALSE otherwise.


JavaDoc