33import android .os .Environment ;
44import android .util .Log ;
55
6- import com .brian .csdnblog .Config ;
7-
86import org .json .JSONArray ;
97import org .json .JSONException ;
108import org .json .JSONObject ;
2018 * @author brian @date 2015年7月24日
2119 */
2220public class LogUtil {
23- private static boolean mIsDebugMode = Config . isDebug ;// 获取堆栈信息会影响性能,发布应用时记得关闭DebugMode
21+ public static boolean mIsDebugMode = true ;// 获取堆栈信息会影响性能,发布应用时记得关闭DebugMode
2422
2523 private static final int JSON_INDENT = 2 ;
2624
27- private static boolean LOGV = mIsDebugMode ;
28- private static boolean LOGF = mIsDebugMode ;
29- private static boolean LOGD = mIsDebugMode ;
30- private static boolean LOGI = mIsDebugMode ;
3125 private static boolean LOGW = true ;
3226 private static boolean LOGE = true ;
3327
3428 public static void v (String tag , String mess ) {
35- if (LOGV ) { Log .v (tag , buildMessageSafe (mess )); }
29+ if (mIsDebugMode ) { Log .v (tag , buildMessageSafe (mess )); }
3630 }
3731 public static void d (String tag , String mess ) {
38- if (LOGD ) { Log .d (tag , buildMessageSafe (mess )); }
32+ if (mIsDebugMode ) { Log .d (tag , buildMessageSafe (mess )); }
3933 }
4034 public static void i (String tag , String mess ) {
41- if (LOGI ) { Log .i (tag , buildMessageSafe (mess )); }
35+ if (mIsDebugMode ) { Log .i (tag , buildMessageSafe (mess )); }
4236 }
4337 public static void w (String tag , String mess ) {
4438 if (LOGW ) { Log .w (tag , buildMessageSafe (mess )); }
@@ -47,14 +41,14 @@ public static void e(String tag, String mess) {
4741 if (LOGE ) { Log .e (tag , buildMessageSafe (mess )); }
4842 }
4943 public static void log (String mess ) {
50- if (LOGD ) { Log .i (getTag (), buildMessageSafe (mess )); }
44+ if (mIsDebugMode ) { Log .i (getTag (), buildMessageSafe (mess )); }
5145 }
5246
5347 /**
5448 * write log to file /sdcard/GameCenter.log
5549 */
5650 public static void f (String tag , String mess ) {
57- if (LOGF ) {
51+ if (mIsDebugMode ) {
5852 writeFile (Environment .getExternalStorageDirectory ().getPath () + System .currentTimeMillis () + ".log" , tag , mess );
5953 }
6054 }
@@ -70,13 +64,13 @@ public static void f(String mess) {
7064 * use the classname as tag
7165 */
7266 public static void v (String mess ) {
73- if (LOGV ) { Log .v (getTag (), buildMessageSafe (mess )); }
67+ if (mIsDebugMode ) { Log .v (getTag (), buildMessageSafe (mess )); }
7468 }
7569 public static void d (String mess ) {
76- if (LOGD ) { Log .d (getTag (), buildMessageSafe (mess )); }
70+ if (mIsDebugMode ) { Log .d (getTag (), buildMessageSafe (mess )); }
7771 }
7872 public static void i (String mess ) {
79- if (LOGI ) { Log .i (getTag (), buildMessageSafe (mess )); }
73+ if (mIsDebugMode ) { Log .i (getTag (), buildMessageSafe (mess )); }
8074 }
8175 public static void w (String mess ) {
8276 if (LOGW ) { Log .w (getTag (), buildMessageSafe (mess )); }
0 commit comments