[Change]
发布新版本1.4.5.10 替换Logger为原生Log,防止过度调用Logger 同步synchronized获取堆栈信息导致卡顿
This commit is contained in:
@@ -9,7 +9,6 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.elegant.log.simplelog.Logger;
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
@@ -98,7 +97,7 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
}
|
||||
if (mListeners.containsKey(msgType)) {
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.w(getTag(), "msgType %d is exist.", msgType);
|
||||
Log.w(getTag(), "msgType " + msgType + " is exist.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -139,7 +138,7 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
}
|
||||
if (mErrorListeners.containsKey(tag)) {
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.w(getTag(), "Type %d is exist.", tag);
|
||||
Log.w(getTag(), "Type " + tag + " is exist.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -160,7 +159,7 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
@Override
|
||||
public void sendMsg(String appId, int headerType, MsgBody body, IMogoCloudSocketMsgAckListener listener) {
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.d(getTag(), "sendMsg msgId : " + body.getMsgId());
|
||||
Log.d(getTag(), "sendMsg msgId : " + body.getMsgId());
|
||||
}
|
||||
|
||||
final byte[] pb = convertToPBBytes(body.getMsgType(), body.getContent());
|
||||
@@ -177,7 +176,7 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
MogoConnsvr.Payload payload = MogoConnsvr.Payload.parseFrom(message);
|
||||
int msgType = payload.getMsgType();
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.d(getTag(), "received msg type = %d", msgType);
|
||||
Log.d(getTag(), "received msg type = " + msgType);
|
||||
}
|
||||
|
||||
List<IMogoCloudSocketOnMessageListener> listeners = mListeners.get(msgType);
|
||||
@@ -212,7 +211,7 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
}
|
||||
if (listener != null && obj != null) {
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.d(getTag(), "received msgId = %s, msgType = %d, content = %s", msgId, msgType, obj);
|
||||
Log.d(getTag(), "received msgId = " + msgId + ", msgType = " + msgType + ", content = " + obj);
|
||||
}
|
||||
listener.onMsgReceived(msgType, obj);
|
||||
}
|
||||
@@ -220,7 +219,6 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
}
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
e.printStackTrace();
|
||||
Logger.e(getTag(), e, "parse msg error.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +244,7 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
listener.onAck(msgId);
|
||||
}
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.d(getTag(), "send message success: msgId = %d msgType = %d, appId = %s, productLine = %d", msgId, msgType, appId, productLine);
|
||||
Log.d(getTag(), "send message success: msgId = " + msgId + " msgType = " + msgType + ", appId = " + appId + ", productLine = " + productLine);
|
||||
}
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.mogo.cloud.socket.internal;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.elegant.log.simplelog.Logger;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.socket.SocketBuildConfig;
|
||||
@@ -47,7 +47,7 @@ public class InternalSocketManager implements OnSocketReceiveCallback, OnSocketA
|
||||
String appId = cloudClientConfig.getServiceAppId();
|
||||
if (TextUtils.isEmpty(appId)) {
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.e(TAG, "需要初始化 Socket AppId");
|
||||
Log.e(TAG, "需要初始化 Socket AppId");
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -58,7 +58,7 @@ public class InternalSocketManager implements OnSocketReceiveCallback, OnSocketA
|
||||
@Override
|
||||
public void onAck(byte[] headerBytes, byte[] payload) {
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.d(TAG, "InternalSocketManager update ack");
|
||||
Log.d(TAG, "InternalSocketManager update ack");
|
||||
}
|
||||
SocketManager.getInstance().onAck(headerBytes);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class InternalSocketManager implements OnSocketReceiveCallback, OnSocketA
|
||||
@Override
|
||||
public void onMessageReceived(byte[] message) {
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.d(TAG, "InternalSocketManager update message");
|
||||
Log.d(TAG, "InternalSocketManager update message");
|
||||
}
|
||||
|
||||
SocketManager.getInstance().update(message, 0);
|
||||
@@ -75,12 +75,12 @@ public class InternalSocketManager implements OnSocketReceiveCallback, OnSocketA
|
||||
public void sendMsg(byte[] pb, int headerType, boolean isAck, long msgId) {
|
||||
if (mSocketConnManager.isConnected()) {
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.d(TAG, "isConnected.");
|
||||
Log.d(TAG, "isConnected.");
|
||||
}
|
||||
|
||||
mSocketConnManager.sendPayload(MSG_PRODUCT_LINE, pb, headerType, isAck, msgId);
|
||||
} else {
|
||||
Logger.e(TAG, "sendMsg error, connect is lost.");
|
||||
Log.e(TAG, "sendMsg error, connect is lost.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ import static com.mogo.cloud.socket.SocketServicesConstants.getTag;
|
||||
import static com.zhidao.socket.location.MLocation.GCJ02;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.elegant.log.simplelog.Logger;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.socket.SocketBuildConfig;
|
||||
@@ -76,7 +76,7 @@ public class ThirdSocketManager implements Callback, ErrorCallback {
|
||||
@Override
|
||||
public void update(@NonNull CallbackManager manager, @NonNull byte[] message, String appId, long msgId) {
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.d(getTag(), "ThirdSocketManager update message");
|
||||
Log.d(getTag(), "ThirdSocketManager update message");
|
||||
}
|
||||
SocketManager.getInstance().update(message, msgId);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class ThirdSocketManager implements Callback, ErrorCallback {
|
||||
@Override
|
||||
public void onAck(@NonNull CallbackManager manager, @NonNull byte[] header, byte[] content) {
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.d(getTag(), "ThirdSocketManager update ack");
|
||||
Log.d(getTag(), "ThirdSocketManager update ack");
|
||||
}
|
||||
|
||||
SocketManager.getInstance().onAck(header);
|
||||
|
||||
Reference in New Issue
Block a user