Android Open Source - rapidLogger Rapid App Log






From Project

Back to project page rapidLogger.

License

The source code is released under:

MIT License

If you think the Android project rapidLogger listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.rapidbiz.logger;
// www .  j a v  a  2 s . c  o  m
import android.content.Context;

import org.apache.log4j.Logger;

public class RapidAppLog {

  private static Logger uilog = null;
  private static Context context;

  //class intialization with default log file name
  public RapidAppLog(Context context) {

    this(context, "rapidLog.txt");

  }

  //class intialization with desired log file name
  public RapidAppLog(Context context, String logfileName) {

    this.context = context;
    if (null == uilog) {
      
      ConfigureLog4J.configure(context, logfileName);
      
      uilog = Logger.getLogger(context.getClass());
      
      uilog.debug("Class Name : "+context.getClass());
      

    }
  }

  //write the debug log to the file and log aswell 
  public static void d(String tag, String msg) {

    uilog.debug(tag + "-" + msg);
  }

  //write the info log to the file and log aswell
  public static void i(String tag, String msg) {

    uilog.info(tag + "-" + msg);
  }

  //write the error log to the file with exception and log aswell
  public static void e(String tag, String msg, Exception e) {

    uilog.error(tag + "-" + msg, e);
  }

  //write the verbose log to the file and log aswell
  public static void v(String tag, String msg) {

    uilog.info(tag + "-" + msg);
  }

  //write the warn log to the file and log aswell
  public static void w(String tag, String msg) {

    uilog.warn(tag + "-" + msg);
  }

}




Java Source Code List

com.rapidbiz.logger.ConfigureLog4J.java
com.rapidbiz.logger.RapidAppLog.java
com.rapidbiz.logger.TestRapidLog.java