mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
disable logging for tagged release builds
This commit is contained in:
parent
1625ec9062
commit
bdbd5bc1ee
2 changed files with 28 additions and 10 deletions
|
@ -16,6 +16,10 @@ if (! forFDroid) {
|
||||||
}
|
}
|
||||||
GITREV = GITREV.execute().text.trim()
|
GITREV = GITREV.execute().text.trim()
|
||||||
|
|
||||||
|
// Make CURTAG non-empty IFF we're at a tag (release build)
|
||||||
|
def CURTAG = "git describe --exact-match".execute().text.trim()
|
||||||
|
// print "CURTAG: " + CURTAG + "\n"
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,6 +67,7 @@ android {
|
||||||
productFlavors {
|
productFlavors {
|
||||||
all {
|
all {
|
||||||
buildConfigField "String", "BUILD_INFO_NAME", "\"${BUILD_INFO_NAME}\""
|
buildConfigField "String", "BUILD_INFO_NAME", "\"${BUILD_INFO_NAME}\""
|
||||||
|
buildConfigField "boolean", "IS_TAGGED_BUILD", "${CURTAG}" == '' ? "false" : "true"
|
||||||
resValue "string", "invite_prefix", "/and/"
|
resValue "string", "invite_prefix", "/and/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,27 +24,40 @@ import java.util.Formatter;
|
||||||
|
|
||||||
public class Log {
|
public class Log {
|
||||||
private static final String PRE_TAG = BuildConfig.FLAVOR + "-";
|
private static final String PRE_TAG = BuildConfig.FLAVOR + "-";
|
||||||
|
private static final boolean LOGGING_ENABLED
|
||||||
|
= BuildConfig.DEBUG || !BuildConfig.IS_TAGGED_BUILD;
|
||||||
|
private static final boolean ERROR_LOGGING_ENABLED = true;
|
||||||
|
|
||||||
public static void d( String tag, String fmt, Object... args ) {
|
public static void d( String tag, String fmt, Object... args ) {
|
||||||
|
if ( LOGGING_ENABLED ) {
|
||||||
String str = new Formatter().format( fmt, args ).toString();
|
String str = new Formatter().format( fmt, args ).toString();
|
||||||
android.util.Log.d( PRE_TAG + tag, str );
|
android.util.Log.d( PRE_TAG + tag, str );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static void w( String tag, String fmt, Object... args ) {
|
public static void w( String tag, String fmt, Object... args ) {
|
||||||
|
if ( LOGGING_ENABLED ) {
|
||||||
String str = new Formatter().format( fmt, args ).toString();
|
String str = new Formatter().format( fmt, args ).toString();
|
||||||
android.util.Log.w( PRE_TAG + tag, str );
|
android.util.Log.w( PRE_TAG + tag, str );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static void e( String tag, String fmt, Object... args ) {
|
public static void e( String tag, String fmt, Object... args ) {
|
||||||
|
if ( ERROR_LOGGING_ENABLED ) {
|
||||||
String str = new Formatter().format( fmt, args ).toString();
|
String str = new Formatter().format( fmt, args ).toString();
|
||||||
android.util.Log.e( PRE_TAG + tag, str );
|
android.util.Log.e( PRE_TAG + tag, str );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static void i( String tag, String fmt, Object... args ) {
|
public static void i( String tag, String fmt, Object... args ) {
|
||||||
|
if ( LOGGING_ENABLED ) {
|
||||||
String str = new Formatter().format( fmt, args ).toString();
|
String str = new Formatter().format( fmt, args ).toString();
|
||||||
android.util.Log.i( PRE_TAG + tag, str );
|
android.util.Log.i( PRE_TAG + tag, str );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void ex( String tag, Exception exception )
|
public static void ex( String tag, Exception exception )
|
||||||
{
|
{
|
||||||
|
if ( LOGGING_ENABLED ) {
|
||||||
w( tag, "Exception: %s", exception.toString() );
|
w( tag, "Exception: %s", exception.toString() );
|
||||||
DbgUtils.printStack( tag, exception.getStackTrace() );
|
DbgUtils.printStack( tag, exception.getStackTrace() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue