Created
October 10, 2012 05:15
-
-
Save Gopinathp/3863295 to your computer and use it in GitHub Desktop.
A wrapper around the Android logger which can skip debug logs on production builds automatically.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tringtringlabs.mykidstory.components; | |
/** | |
* @author gopinath | |
* A wrapper around the regular Android logger which will disable debug logs in production automatically. | |
*/ | |
import android.util.Log; | |
import com.tringtringlabs.mykidstory.App; | |
import com.tringtringlabs.mykidstory.BuildConfig; | |
public class GLogger { | |
private static final String TAG = App.getContext().getPackageName(); | |
public static void d(String msg) { | |
if(BuildConfig.DEBUG) | |
Log.d(TAG, msg); | |
} | |
public static void e(String msg) { | |
Log.e(TAG, msg); | |
} | |
public static void w(String msg) { | |
Log.w(TAG, msg); | |
} | |
public static void v(String msg) { | |
if(BuildConfig.DEBUG) | |
Log.v(TAG, msg); | |
} | |
public static void i(String msg) { | |
if(BuildConfig.DEBUG) | |
Log.i(TAG, msg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment