Skip to content

Commit 1b36477

Browse files
committed
fix log
1 parent 1cfd653 commit 1b36477

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ def releaseTime() {
1010
// 打debug包命令 gradlew assembleDebug
1111
android {
1212
compileSdkVersion 24
13-
buildToolsVersion "24.0.2"
13+
buildToolsVersion "24.0.3"
1414

1515
defaultConfig {
1616
applicationId "com.brian.csdnblog"
1717
minSdkVersion 15
1818
targetSdkVersion 24
19-
versionCode 79
20-
versionName "1.3.79"
19+
versionCode 80
20+
versionName "1.3.80"
2121
multiDexEnabled true
2222
vectorDrawables.useSupportLibrary = true
2323

app/src/main/java/com/brian/csdnblog/activity/BaseActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private void initStatusBar() {
123123
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
124124
return;
125125
}
126-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
126+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
127127
getWindow().setStatusBarColor(ResourceUtil.getColor(R.color.light_blue));
128128
}
129129
}

app/src/main/java/com/brian/csdnblog/util/ConfigHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public static void init(Context context) {
1818
ApplicationInfo info = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
1919
// 打包时动态更改LOG_DEBUG
2020
Config.isDebug = BuildConfig.LOG_DEBUG;
21+
LogUtil.mIsDebugMode = Config.isDebug;
2122

2223
AppInfoUtil.sChannelName = info.metaData.getString("UMENG_CHANNEL");
2324
} catch (Exception e) {

app/src/main/java/com/brian/csdnblog/util/LogUtil.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import android.os.Environment;
44
import android.util.Log;
55

6-
import com.brian.csdnblog.Config;
7-
86
import org.json.JSONArray;
97
import org.json.JSONException;
108
import org.json.JSONObject;
@@ -20,25 +18,21 @@
2018
* @author brian @date 2015年7月24日
2119
*/
2220
public 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

Comments
 (0)