[3.3.0] reset log tag

This commit is contained in:
zhongchao
2023-06-15 18:32:58 +08:00
parent 1692004f4b
commit e2a60783ec
33 changed files with 129 additions and 326 deletions

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.utilcode.mogo;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL;
import android.content.Context;
import android.net.ConnectivityManager;
@@ -8,7 +7,6 @@ import android.os.Build;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -79,9 +77,7 @@ public class TelephoneUtil {
Method getMobileDataEnabledMethod = iConMgrClass.getDeclaredMethod("getMobileDataEnabled");
if (getMobileDataEnabledMethod != null) {
getMobileDataEnabledMethod.setAccessible(true);
boolean result = (Boolean) getMobileDataEnabledMethod.invoke(iConMgr);
CallerLogger.INSTANCE.d(M_UTIL + "TelephoneUtil", "getMobileDataEnabled = " + result);
return result;
return (boolean) (Boolean) getMobileDataEnabledMethod.invoke(iConMgr);
}
} catch (Exception e) {
e.printStackTrace();
@@ -92,9 +88,7 @@ public class TelephoneUtil {
try {
Method getDataEnabled = telephonyService.getClass().getDeclaredMethod("getDataEnabled");
if (null != getDataEnabled) {
boolean result = (Boolean) getDataEnabled.invoke(telephonyService);
CallerLogger.INSTANCE.d(M_UTIL + "TelephoneUtil", "getDataEnabled = " + result);
return result;
return (boolean) (Boolean) getDataEnabled.invoke(telephonyService);
}
} catch (Exception e) {
e.printStackTrace();
@@ -120,7 +114,6 @@ public class TelephoneUtil {
if (setMobileDataEnabledMethod != null) {
setMobileDataEnabledMethod.setAccessible(true);
setMobileDataEnabledMethod.invoke(iConMgr, enable);
CallerLogger.INSTANCE.d(M_UTIL + "TelephoneUtil", "setMobileDataEnabled = " + enable);
}
} catch (Exception e) {
e.printStackTrace();
@@ -132,7 +125,6 @@ public class TelephoneUtil {
Method setDataEnabledMethod = telephonyService.getClass().getDeclaredMethod("setDataEnabled", boolean.class);
if (null != setDataEnabledMethod) {
setDataEnabledMethod.invoke(telephonyService, enable);
CallerLogger.INSTANCE.d(M_UTIL + "TelephoneUtil", "setDataEnabled = " + enable);
}
} catch (Exception e) {
e.printStackTrace();

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.utilcode.mogo.glide.transform;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL;
import android.content.Context;
import android.graphics.Bitmap;
@@ -13,7 +12,6 @@ import androidx.annotation.NonNull;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
/**
* 使用Glide加载图片时使该图片进行高斯模糊
@@ -48,8 +46,6 @@ public class GlideBlurTransformation extends CenterCrop {
protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform,
int outWidth, int outHeight) {
Bitmap bitmap = super.transform(pool, toTransform, outWidth, outHeight);
CallerLogger.INSTANCE.d(M_UTIL + "GlideBlurTransformation", "transform=== blurRadius: " + blurRadius + " " +
"outScale: " + outScale);
return blurBitmap(bitmap, blurRadius, (int) (outWidth * outScale), (int) (outHeight * outScale));
}

View File

@@ -1,14 +1,13 @@
package com.mogo.eagle.core.utilcode.mogo.logger.scene
import android.util.ArrayMap
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_D_C
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_CHAT
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_NETWORK
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OLD_ROUTE
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OTHER
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_SWEEPER
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_TAXI
@@ -37,28 +36,22 @@ class Scene {
sceneCache[M_NETWORK] = networkMap
//初始化ADAS
val adasMap = SceneLogCache(mutableMapOf(), true)
sceneCache[M_ADAS_IMPL] = adasMap
//初始化CallChat
val callChatMap = SceneLogCache(mutableMapOf(), false)
sceneCache[M_CHAT] = callChatMap
sceneCache[M_D_C] = adasMap
//初始化deva
val devaMap = SceneLogCache(mutableMapOf(), false)
sceneCache[M_DEVA] = devaMap
//初始化hmi
val hmiMap = SceneLogCache(mutableMapOf(), false)
sceneCache[M_HMI] = hmiMap
//初始化hmi
val obuMap = SceneLogCache(mutableMapOf(), true)
sceneCache[M_OBU] = obuMap
//初始化v2x
val v2xMap = SceneLogCache(mutableMapOf(), false)
val v2xMap = SceneLogCache(mutableMapOf(), true)
sceneCache[M_V2X] = v2xMap
//初始化map
val map = SceneLogCache(mutableMapOf(), true)
sceneCache[M_MAP] = map
//初始化路径规划
val routeMap = SceneLogCache(mutableMapOf(), true)
sceneCache[M_OLD_ROUTE] = routeMap
//初始化其他模块,方便定位索引
val otherMap = SceneLogCache(mutableMapOf(), true)
sceneCache[M_OTHER] = otherMap
//初始化TAXI
val taxiMap = SceneLogCache(mutableMapOf(), true)
sceneCache[M_TAXI] = taxiMap

View File

@@ -6,28 +6,19 @@ class SceneConstant {
//核心module
const val M_NETWORK = "M_NETWORK-"
const val M_UTIL = "M_UTIL-"
//Main
const val M_MAIN = "M_MAIN-"
//core业务module
const val M_ADAS_IMPL = "M_ADAS_IMPL-"
const val M_BINDING = "M_BINDING-"
const val M_CHAT = "M_CHAT-"
const val M_D_C = "M_DATA_CENTER-"
const val M_DEVA = "M_DEVA-"
const val M_DISPATCH = "M_DISPATCH-"
const val M_HMI = "M_HMI-"
const val M_MAP = "M_MAP-"
const val M_MONITOR = "M_MONITOR-"
const val M_NOTICE = "M_NOTICE-"
const val M_BIZ = "M_BIZ-"
const val M_OBU = "M_OBU-"
const val M_V2X = "M_V2X-"
const val M_F = "M_F-"
//旧module
const val M_OLD_ROUTE = "M_OLD_ROUTE-"
const val M_OLD_OTHER = "M_OLD_OTHER-"
const val M_OTHER = "M_OTHER-"
// Och common

View File

@@ -1,12 +1,10 @@
package com.mogo.eagle.core.utilcode.mogo.sqlite;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.utils.sqlite.annotation.DbField;
import com.mogo.utils.sqlite.annotation.DbTable;
@@ -57,7 +55,6 @@ public class SQLBaseDao<T> implements SQLIDao<T> {
//执行Sql进行自动建表
String createTableSql = getCreateTableSql();
CallerLogger.INSTANCE.d(M_UTIL + TAG, "执行SQL" + createTableSql);
sqLiteDatabase.execSQL(createTableSql);
//初始化缓存空间
@@ -393,7 +390,6 @@ public class SQLBaseDao<T> implements SQLIDao<T> {
e.printStackTrace();
}
}
CallerLogger.INSTANCE.d(M_UTIL + TAG, "contentValues:" + contentValues);
return contentValues;
}

View File

@@ -1,7 +1,5 @@
package com.mogo.utils.sqlite.proxy
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_UTIL
import java.lang.reflect.InvocationHandler
import java.lang.reflect.Method
import java.lang.reflect.Proxy
@@ -43,12 +41,8 @@ class BaseDaoProxyLog : InvocationHandler {
*/
@Throws(Throwable::class)
override fun invoke(proxy: Any, method: Method, args: Array<Any>): Any? {
//反射方法前调用
CallerLogger.i("$M_UTIL$TAG", "SQL数据库管理 当前执行>>${method.name}>>")
//反射执行方法 相当于调用target.sayHelllo;
val result: Any? = method.invoke(target, *args)
//反射方法后调用.
CallerLogger.i("$M_UTIL$TAG", "SQL数据库管理 执行结果>>$result")
return result
}
}

View File

@@ -10,11 +10,11 @@ package com.mogo.eagle.core.utilcode.mogo.toast;
* @Version 1.1
*/
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL;
import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.Toast;
@@ -25,7 +25,6 @@ import androidx.lifecycle.LifecycleEventObserver;
import androidx.lifecycle.LifecycleOwner;
import com.mogo.eagle.core.utilcode.kotlin.ExtensionsKt;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
@@ -89,11 +88,11 @@ public final class TipToast {
private static boolean checkParams() {
if (sContext == null) {
CallerLogger.INSTANCE.e(M_UTIL + TAG, "context can't be null.");
Log.e(TAG, "context can't be null.");
return false;
}
if (sHandler == null) {
CallerLogger.INSTANCE.e(M_UTIL + TAG, "sHandler can't be null.");
Log.e(TAG, "sHandler can't be null.");
return false;
}
return true;

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.utilcode.util;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL;
import android.app.Activity;
import android.app.ActivityManager;
@@ -22,7 +21,6 @@ import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import java.io.File;
import java.util.ArrayList;
@@ -360,7 +358,6 @@ public final class AppUtils {
if (UtilsBridge.isSpace(packageName)) return;
Intent launchAppIntent = UtilsBridge.getLaunchAppIntent(packageName);
if (launchAppIntent == null) {
CallerLogger.INSTANCE.e(M_UTIL + "AppUtils", "Didn't exist launcher activity.");
return;
}
Utils.getApp().startActivity(launchAppIntent);
@@ -381,7 +378,6 @@ public final class AppUtils {
public static void relaunchApp(final boolean isKillProcess) {
Intent intent = UtilsBridge.getLaunchAppIntent(Utils.getApp().getPackageName());
if (intent == null) {
CallerLogger.INSTANCE.e(M_UTIL + "AppUtils", "Didn't exist launcher activity.");
return;
}
intent.addFlags(

View File

@@ -1,7 +1,6 @@
package com.mogo.eagle.core.utilcode.util;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -20,7 +19,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
/**
* <pre>
@@ -121,7 +119,6 @@ public final class BusUtils {
isNeedRecordTags = true;
}
if (buses.contains(bus)) {
CallerLogger.INSTANCE.w(M_UTIL + TAG, "The bus of <" + bus + "> already registered.");
return;
} else {
buses.add(bus);
@@ -171,7 +168,6 @@ public final class BusUtils {
private void consumeSticky(final Object bus, final String tag, final Object arg) {
List<BusInfo> busInfoList = mTag_BusInfoListMap.get(tag);
if (busInfoList == null) {
CallerLogger.INSTANCE.e(M_UTIL + TAG, "The bus of tag <" + tag + "> is not exists.");
return;
}
for (BusInfo busInfo : busInfoList) {
@@ -198,7 +194,6 @@ public final class BusUtils {
synchronized (mClassName_BusesMap) {
Set<Object> buses = mClassName_BusesMap.get(className);
if (buses == null || !buses.contains(bus)) {
CallerLogger.INSTANCE.e(M_UTIL + TAG, "The bus of <" + bus + "> was not registered before.");
return;
}
buses.remove(bus);
@@ -212,10 +207,6 @@ public final class BusUtils {
private void postInner(final String tag, final Object arg, final boolean sticky) {
List<BusInfo> busInfoList = mTag_BusInfoListMap.get(tag);
if (busInfoList == null) {
CallerLogger.INSTANCE.e(M_UTIL + TAG, "The bus of tag <" + tag + "> is not exists.");
if (mTag_BusInfoListMap.isEmpty()) {
CallerLogger.INSTANCE.e(M_UTIL + TAG, "Please check whether the bus plugin is applied.");
}
return;
}
for (BusInfo busInfo : busInfoList) {
@@ -318,9 +309,6 @@ public final class BusUtils {
}
}
if (buses.size() == 0) {
if (!sticky) {
CallerLogger.INSTANCE.e(M_UTIL + TAG, "The " + busInfo + " was not registered before.");
}
return;
}
} else {
@@ -350,7 +338,6 @@ public final class BusUtils {
private void postStickyInner(final String tag, final Object arg) {
List<BusInfo> busInfoList = mTag_BusInfoListMap.get(tag);
if (busInfoList == null) {
CallerLogger.INSTANCE.e(M_UTIL + TAG, "The bus of tag <" + tag + "> is not exists.");
return;
}
// 获取多对象,然后消费各个 busInfoList
@@ -374,7 +361,6 @@ public final class BusUtils {
private void removeStickyInner(final String tag) {
List<BusInfo> busInfoList = mTag_BusInfoListMap.get(tag);
if (busInfoList == null) {
CallerLogger.INSTANCE.e(M_UTIL + TAG, "The bus of tag <" + tag + "> is not exists.");
return;
}
for (BusInfo busInfo : busInfoList) {

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.utilcode.util;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -25,7 +24,6 @@ import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.core.view.ViewCompat;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
/**
* <pre>
@@ -361,7 +359,6 @@ public class ClickUtils {
final int expandSizeBottom) {
final View parentView = (View) view.getParent();
if (parentView == null) {
CallerLogger.INSTANCE.e(M_UTIL + "ClickUtils", "expandClickArea must have parent view.");
return;
}
parentView.post(new Runnable() {

View File

@@ -1,9 +1,9 @@
package com.mogo.eagle.core.utilcode.util;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@@ -160,7 +160,7 @@ public final class FileIOUtils {
final boolean append,
final OnProgressUpdateListener listener) {
if (is == null || !UtilsBridge.createOrExistsFile(file)) {
CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "create file <" + file + "> failed.");
Log.e( "FileIOUtils", "create file <" + file + "> failed.");
return false;
}
OutputStream os = null;
@@ -380,18 +380,18 @@ public final class FileIOUtils {
final boolean append,
final boolean isForce) {
if (bytes == null) {
CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "bytes is null.");
Log.e( "FileIOUtils", "bytes is null.");
return false;
}
if (!UtilsBridge.createOrExistsFile(file)) {
CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "create file <" + file + "> failed.");
Log.e( "FileIOUtils", "create file <" + file + "> failed.");
return false;
}
FileChannel fc = null;
try {
fc = new FileOutputStream(file, append).getChannel();
if (fc == null) {
CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "fc is null.");
Log.e( "FileIOUtils", "fc is null.");
return false;
}
fc.position(fc.size());
@@ -470,14 +470,14 @@ public final class FileIOUtils {
final boolean append,
final boolean isForce) {
if (bytes == null || !UtilsBridge.createOrExistsFile(file)) {
CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "create file <" + file + "> failed.");
Log.e( "FileIOUtils", "create file <" + file + "> failed.");
return false;
}
FileChannel fc = null;
try {
fc = new FileOutputStream(file, append).getChannel();
if (fc == null) {
CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "fc is null.");
Log.e( "FileIOUtils", "fc is null.");
return false;
}
MappedByteBuffer mbb = fc.map(FileChannel.MapMode.READ_WRITE, fc.size(), bytes.length);
@@ -547,7 +547,7 @@ public final class FileIOUtils {
final boolean append) {
if (file == null || content == null) return false;
if (!UtilsBridge.createOrExistsFile(file)) {
CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "create file <" + file + "> failed.");
Log.e( "FileIOUtils", "create file <" + file + "> failed.");
return false;
}
BufferedWriter bw = null;
@@ -872,7 +872,7 @@ public final class FileIOUtils {
try {
fc = new RandomAccessFile(file, "r").getChannel();
if (fc == null) {
CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "fc is null.");
Log.e( "FileIOUtils", "fc is null.");
return new byte[0];
}
ByteBuffer byteBuffer = ByteBuffer.allocate((int) fc.size());
@@ -916,7 +916,7 @@ public final class FileIOUtils {
try {
fc = new RandomAccessFile(file, "r").getChannel();
if (fc == null) {
CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "fc is null.");
Log.e( "FileIOUtils", "fc is null.");
return new byte[0];
}
int size = (int) fc.size();