Android Open Source - goodintentions Log Utils






From Project

Back to project page goodintentions.

License

The source code is released under:

Apache License

If you think the Android project goodintentions 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.luboganev.goodintentions;
//from w  w w.  j a v a  2 s . c om
import android.util.Log;

/**
 * Useful class which logs debug or error messages 
 * under a specific TAG when in debug mode
 */
public class LogUtils {
  public static final String TAG = "GoodIntentions";
  
  /**
   *   This variable defines the current mode of the application. 
   *   When it is being released, the debug mode will be set to false.
   */
  public static final boolean DEBUG = true;
  
  /**
   *   Prints a debug message in the system log
   * 
   * @param sender
   *     A string with custom name or a class
   * @param message
   *     The message to be logged
   */
  public static void d(Object sender, String message) {
    if(DEBUG) Log.d(TAG,  getSenderString(sender) + ": " + message);
  }
  
  /**
   *   Prints an error message in the system log
   * 
   * @param sender
   *     A string with custom name or a class
   * @param message
   *     The message to be logged
   */
  public static void e(Object sender, String message) {
    if(DEBUG) Log.e(TAG,  getSenderString(sender) + ": " + message);
  }
  
  /**
   * Gets the name of the Class of the input object
   * 
   * @param sender
   *     The input object 
   * @return
   */
  private static String getSenderString(Object sender) {
    if(sender instanceof String) {
      return (String)sender;
    }
    else return sender.getClass().getSimpleName();
  }
}




Java Source Code List

com.luboganev.goodintentions.IntentionLauncher.java
com.luboganev.goodintentions.LogUtils.java
com.luboganev.goodintentions.UIUtils.java
com.luboganev.goodintentions.data.Intention.java
com.luboganev.goodintentions.data.LocalStorageManager.java
com.luboganev.goodintentions.data.LocalStorage.java
com.luboganev.goodintentions.ui.AboutActivity.java
com.luboganev.goodintentions.ui.MainActivity$$ViewInjector.java
com.luboganev.goodintentions.ui.MainActivity.java
com.luboganev.goodintentions.ui.views.IntentionCategoriesLinearLayout$$ViewInjector.java
com.luboganev.goodintentions.ui.views.IntentionCategoriesLinearLayout.java
com.luboganev.goodintentions.ui.views.IntentionFlagsLinearLayout$$ViewInjector.java
com.luboganev.goodintentions.ui.views.IntentionFlagsLinearLayout.java