Log Utility : Log « Core Class « Android






Log Utility

    
//package com.cloud.charts4a.util;

import android.util.Log;

/**
 * Log Utility<p/>
 * 
 * @version
 * <ol>
 *   <li>2010/07/09 CloudTu?First Release</li>
 * </ol>
 * 
 * @author Cloud Tu
 */
class LogUtil {

  private LogUtil(){    
  }
  
  /**
   * Log a message object with the DEBUG  level. 
   * 
   * @param clazz    The name of clazz will be used as the name of the logger to retrieve.  
   * @param message  the message object to log.
   */
  public static void debug(Class<?> clazz,String message){
    Log.d(clazz.getName(), message);
  }
  
  /**
   * Log a message object with the INFO  Level.
   * 
   * @param clazz    The name of clazz will be used as the name of the logger to retrieve.  
   * @param message  the message object to log.
   */
  public static void info(Class<?> clazz,String message){
    Log.i(clazz.getName(), message);
  }
  
  /**
   * Log a message object with the WARN  Level.
   * 
   * @param clazz    The name of clazz will be used as the name of the logger to retrieve.  
   * @param message  the message object to log.
   */
  public static void warn(Class<?> clazz,String message){
    Log.w(clazz.getName(), message);
  }
  
  /**
   * Log a message with the WARN level including the stack trace of the Throwable t passed as parameter. 
   * 
   * @param clazz    The name of clazz will be used as the name of the logger to retrieve.  
   * @param message  the message object to log.
   * @param t      the exception to log, including its stack trace.
   */
  public static void warn(Class<?> clazz,String message,Throwable t){
    Log.w(clazz.getName(), message,t);
  }    
  
  /**
   * Log a message object with the ERROR  Level. 
   * 
   * @param clazz    The name of clazz will be used as the name of the logger to retrieve.  
   * @param message  the message object to log.
   */
  public static void error(Class<?> clazz,String message){
    Log.e(clazz.getName(), message);
  }
  
  /**
   * Log a message object with the ERROR level including the stack trace of the Throwable t passed as parameter. 
   * 
   * @param clazz    The name of clazz will be used as the name of the logger to retrieve.
   * @param message  the message object to log.
   * @param t      the exception to log, including its stack trace.
   */
  public static void error(Class<?> clazz,String message,Throwable t){
    Log.e(clazz.getName(), message,t);
  }  
}

   
    
    
    
  








Related examples in the same category

1.Use log
2.Log events
3.Log your action
4.Write an activity that looks like a pop-up dialog with a custom theme using a different text color.
5.Responsible for delegating calls to the Android logging system.
6.Dynamically defined), space efficient event logging to help instrument code for large scale stability and performance monitoring.
7.Write Exception Stack to Log
8.Logger and Logger Listener
9.Log Exception trace
10.Log a list of objects
11.Utility log tool
12.Debug Util