Android Open Source - MightyV My Log






From Project

Back to project page MightyV.

License

The source code is released under:

Apache License

If you think the Android project MightyV 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.indivisible.mightyv.util;
//  w  ww .java2  s.com
import android.util.Log;

//REM level checks to be done inline on call of these methods

/**
 * Wrapper around the inbuilt Android logging allowing for configurable logging levels.
 * Inline tests for appropriate log level should be made before invoking a call to a log method.
 * <pre>eg
 * <code> if (MyLog.info) MyLog.i(tag, msg); </code></pre>
 * @author indivisible
 */
public class MyLog
{
  //=================================================//
  //    data
  //=================================================//
  
  // log tag prefix
  private static final String TAG_PREFIX = "mV:";
  
  // application wide logging level  //TODO move to Preferences (once they exist [and in an "advanced" section])
  public static final int LOG_LEVEL = 10;    // set to -1 to disable all logging (not recommended)
  
  // logging levels defined
  public static boolean debug   = LOG_LEVEL > 6;
  public static boolean verbose = LOG_LEVEL > 5;
  public static boolean info    = LOG_LEVEL > 4;
  public static boolean warn    = LOG_LEVEL > 3;
  public static boolean error   = LOG_LEVEL > 2;
  public static boolean wtf     = LOG_LEVEL > 1;
  
//  // enumerator for levels. thought I might use it. i didn't
//  public static enum logLevel {
//    levelDebug,
//    levelVerbose,
//    levelInfo,
//    levelWarn,
//    levelError,
//    levelWTF
//  };
  
  
  //=================================================//
  //    calls to Android logging
  //=================================================//
  
  // perform logging.
  public static void d(String tag, String msg)
  {
    Log.d(formattedTag(tag), msg);
  }
  public static void v(String tag, String msg)
  {
    Log.v(formattedTag(tag), msg);
  }
  public static void i(String tag, String msg)
  {
    Log.i(formattedTag(tag), msg);
  }
  public static void w(String tag, String msg)
  {
    Log.w(formattedTag(tag), msg);
  }
  public static void e(String tag, String msg)
  {
    Log.e(formattedTag(tag), msg);
  }
  public static void wtf(String tag, String msg)
  {
    Log.wtf(formattedTag(tag), msg);
  }
  
  
  //=================================================//
  //    custom methods
  //=================================================//
  
  // format tag for log entry
  private static final String formattedTag(String tag)
  {
    return TAG_PREFIX.concat(tag);
    //return tag;
  }
  
  
  //=================================================//
}




Java Source Code List

com.indivisible.mightyv.activities.ShowAddActivity.java
com.indivisible.mightyv.activities.ShowSearchActivity.java
com.indivisible.mightyv.activities.testing.TestEpisodes.java
com.indivisible.mightyv.activities.testing.TestMenu.java
com.indivisible.mightyv.activities.testing.TestSearch.java
com.indivisible.mightyv.activities.testing.TestShows.java
com.indivisible.mightyv.data.DBMediaOpenHelper.java
com.indivisible.mightyv.data.EpisodeDataSource.java
com.indivisible.mightyv.data.Episode.java
com.indivisible.mightyv.data.ShowDataSource.java
com.indivisible.mightyv.data.Show.java
com.indivisible.mightyv.dialogs.SearchShowEntryDialog.java
com.indivisible.mightyv.dialogs.SearchShowResultsDialog.java
com.indivisible.mightyv.dialogs.SelectShowDialog.java
com.indivisible.mightyv.fragments.EpisodeListFragment.java
com.indivisible.mightyv.fragments.ShowAddButtonsFragment.java
com.indivisible.mightyv.fragments.ShowListFragment.java
com.indivisible.mightyv.fragments.ShowRageSearchFragment.java
com.indivisible.mightyv.util.Convert.java
com.indivisible.mightyv.util.EpisodeArrayAdapter.java
com.indivisible.mightyv.util.MyLog.java
com.indivisible.mightyv.util.ShowArrayAdapter.java
com.tvrage.api.EpisodeListXMLParser.java
com.tvrage.api.SearchXMLParser.java
com.tvrage.api.XMLParser.java