Skip to content

Commit 8abe778

Browse files
committed
Issue nostra13#270 - Printing log messages should be configurable
Added L.disableLogging() and .enableLogging() to completely on/off UIL's logs
1 parent b241677 commit 8abe778

File tree

1 file changed

+12
-3
lines changed
  • library/src/com/nostra13/universalimageloader/utils

1 file changed

+12
-3
lines changed

library/src/com/nostra13/universalimageloader/utils/L.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,31 @@
1515
*******************************************************************************/
1616
package com.nostra13.universalimageloader.utils;
1717

18-
import com.nostra13.universalimageloader.core.ImageLoader;
19-
2018
import android.util.Log;
19+
import com.nostra13.universalimageloader.core.ImageLoader;
2120

2221
/**
2322
* "Less-word" analog of Android {@link Log logger}
24-
*
23+
*
2524
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
2625
* @since 1.6.4
2726
*/
2827
public final class L {
2928

3029
private static final String LOG_FORMAT = "%1$s\n%2$s";
30+
private static volatile boolean DISABLED = false;
3131

3232
private L() {
3333
}
3434

35+
public static void enableLogging() {
36+
DISABLED = false;
37+
}
38+
39+
public static void disableLogging() {
40+
DISABLED = true;
41+
}
42+
3543
public static void d(String message, Object... args) {
3644
log(Log.DEBUG, null, message, args);
3745
}
@@ -57,6 +65,7 @@ public static void e(Throwable ex, String message, Object... args) {
5765
}
5866

5967
private static void log(int priority, Throwable ex, String message, Object... args) {
68+
if (DISABLED) return;
6069
if (args.length > 0) {
6170
message = String.format(message, args);
6271
}

0 commit comments

Comments
 (0)