diff --git a/slf4j-android/src/main/java/org/slf4j/impl/AndroidLogger.java b/slf4j-android/src/main/java/org/slf4j/impl/AndroidLogger.java index 19a8d79..7623acd 100755 --- a/slf4j-android/src/main/java/org/slf4j/impl/AndroidLogger.java +++ b/slf4j-android/src/main/java/org/slf4j/impl/AndroidLogger.java @@ -82,19 +82,28 @@ public class AndroidLogger extends MarkerIgnoringBase /* @see org.slf4j.Logger#trace(java.lang.String, java.lang.Object) */ public void trace(final String format, final Object param1) { - Log.v(name, format(format, param1, null)); + if (Log.isLoggable(name, Log.VERBOSE)) + { + Log.v(name, format(format, param1, null)); + } } /* @see org.slf4j.Logger#trace(java.lang.String, java.lang.Object, java.lang.Object) */ public void trace(final String format, final Object param1, final Object param2) { - Log.v(name, format(format, param1, param2)); + if (Log.isLoggable(name, Log.VERBOSE)) + { + Log.v(name, format(format, param1, param2)); + } } /* @see org.slf4j.Logger#trace(java.lang.String, java.lang.Object[]) */ public void trace(final String format, final Object[] argArray) { - Log.v(name, format(format, argArray)); + if (Log.isLoggable(name, Log.VERBOSE)) + { + Log.v(name, format(format, argArray)); + } } /* @see org.slf4j.Logger#trace(java.lang.String, java.lang.Throwable) */ @@ -118,19 +127,28 @@ public class AndroidLogger extends MarkerIgnoringBase /* @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object) */ public void debug(final String format, final Object arg1) { - Log.d(name, format(format, arg1, null)); + if (Log.isLoggable(name, Log.DEBUG)) + { + Log.d(name, format(format, arg1, null)); + } } /* @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object, java.lang.Object) */ public void debug(final String format, final Object param1, final Object param2) { - Log.d(name, format(format, param1, param2)); + if (Log.isLoggable(name, Log.DEBUG)) + { + Log.d(name, format(format, param1, param2)); + } } /* @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object[]) */ public void debug(final String format, final Object[] argArray) { - Log.d(name, format(format, argArray)); + if (Log.isLoggable(name, Log.DEBUG)) + { + Log.d(name, format(format, argArray)); + } } /* @see org.slf4j.Logger#debug(java.lang.String, java.lang.Throwable) */ @@ -154,19 +172,28 @@ public class AndroidLogger extends MarkerIgnoringBase /* @see org.slf4j.Logger#info(java.lang.String, java.lang.Object) */ public void info(final String format, final Object arg) { - Log.i(name, format(format, arg, null)); + if (Log.isLoggable(name, Log.INFO)) + { + Log.i(name, format(format, arg, null)); + } } /* @see org.slf4j.Logger#info(java.lang.String, java.lang.Object, java.lang.Object) */ public void info(final String format, final Object arg1, final Object arg2) { - Log.i(name, format(format, arg1, arg2)); + if (Log.isLoggable(name, Log.INFO)) + { + Log.i(name, format(format, arg1, arg2)); + } } /* @see org.slf4j.Logger#info(java.lang.String, java.lang.Object[]) */ public void info(final String format, final Object[] argArray) { - Log.i(name, format(format, argArray)); + if (Log.isLoggable(name, Log.INFO)) + { + Log.i(name, format(format, argArray)); + } } /* @see org.slf4j.Logger#info(java.lang.String, java.lang.Throwable) */ @@ -190,7 +217,10 @@ public class AndroidLogger extends MarkerIgnoringBase /* @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object) */ public void warn(final String format, final Object arg) { - Log.w(name, format(format, arg, null)); + if (Log.isLoggable(name, Log.WARN)) + { + Log.w(name, format(format, arg, null)); + } } /* @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object, java.lang.Object) */ @@ -202,7 +232,10 @@ public class AndroidLogger extends MarkerIgnoringBase /* @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object[]) */ public void warn(final String format, final Object[] argArray) { - Log.w(name, format(format, argArray)); + if (Log.isLoggable(name, Log.WARN)) + { + Log.w(name, format(format, argArray)); + } } /* @see org.slf4j.Logger#warn(java.lang.String, java.lang.Throwable) */ @@ -226,19 +259,28 @@ public class AndroidLogger extends MarkerIgnoringBase /* @see org.slf4j.Logger#error(java.lang.String, java.lang.Object) */ public void error(final String format, final Object arg) { - Log.e(name, format(format, arg, null)); + if (Log.isLoggable(name, Log.ERROR)) + { + Log.e(name, format(format, arg, null)); + } } /* @see org.slf4j.Logger#error(java.lang.String, java.lang.Object, java.lang.Object) */ public void error(final String format, final Object arg1, final Object arg2) { - Log.e(name, format(format, arg1, arg2)); + if (Log.isLoggable(name, Log.ERROR)) + { + Log.e(name, format(format, arg1, arg2)); + } } /* @see org.slf4j.Logger#error(java.lang.String, java.lang.Object[]) */ public void error(final String format, final Object[] argArray) { - Log.e(name, format(format, argArray)); + if (Log.isLoggable(name, Log.ERROR)) + { + Log.e(name, format(format, argArray)); + } } /* @see org.slf4j.Logger#error(java.lang.String, java.lang.Throwable) */