Skip to content

Instantly share code, notes, and snippets.

@Gopinathp
Created October 10, 2012 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gopinathp/3863295 to your computer and use it in GitHub Desktop.
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.
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