From 40eb16208b55967ec994c00b4e873db9a1e175d0 Mon Sep 17 00:00:00 2001 From: lizhanwei <Dana_Lee1016@126.com> Date: 星期日, 22 三月 2020 11:15:27 +0800 Subject: [PATCH] 优化log;实现联网考试、单机训练科二科三考试 --- im_lib/src/main/java/com/anyun/im_lib/netty/NettyTcpClient.java | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/im_lib/src/main/java/com/anyun/im_lib/netty/NettyTcpClient.java b/im_lib/src/main/java/com/anyun/im_lib/netty/NettyTcpClient.java index 17ed3bf..b0953bd 100644 --- a/im_lib/src/main/java/com/anyun/im_lib/netty/NettyTcpClient.java +++ b/im_lib/src/main/java/com/anyun/im_lib/netty/NettyTcpClient.java @@ -13,6 +13,7 @@ import com.anyun.im_lib.listener.OnEventListener; import com.anyun.im_lib.util.ByteUtil; import com.anyun.im_lib.util.MyLog; +import com.anyun.im_lib.util.PlatFormConstant; import com.safeluck.aykj.utils.BytesUtils; import java.nio.ByteBuffer; @@ -183,7 +184,7 @@ try { channel = bootstrap.connect(currentHost,currentPort).sync().channel(); } catch (Exception e) { - Log.i(TAG, String.format("杩炴帴Server(ip[%s],port[%d]澶辫触)",currentHost,currentPort)); + MyLog.i(PlatFormConstant.TAG, String.format("杩炴帴Server(ip[%s],port[%d]澶辫触)",currentHost,currentPort)); try { Thread.sleep(500); } catch (InterruptedException ex) { @@ -210,13 +211,13 @@ this.connectStatus = connectStateConnecting; switch (connectStatus){ case IMSConfig.CONNECT_STATE_CONNECTING: - Log.i(TAG, "onConnectStatusCallback: ims杩炴帴涓�..."); + MyLog.i(PlatFormConstant.TAG, "onConnectStatusCallback: ims杩炴帴涓�..."); if (imsConnectStatusCallback != null){ imsConnectStatusCallback.onConnecting(); } break; case IMSConfig.CONNECT_STATE_SUCCESSFUL: - MyLog.i(String.format("onConnectStatusCallback: ims杩炴帴鎴愬姛锛宧ost[%s],port[%s]",currentHost,currentPort)); + MyLog.i(PlatFormConstant.TAG,String.format("onConnectStatusCallback: ims杩炴帴鎴愬姛锛宧ost[%s],port[%s]",currentHost,currentPort)); if (imsConnectStatusCallback != null){ imsConnectStatusCallback.onConnected(); } @@ -232,7 +233,7 @@ break; case IMSConfig.CONNECT_STATE_FAILURE: default: - MyLog.i( "onConnectStatusCallback: ims杩炴帴澶辫触"); + MyLog.i( PlatFormConstant.TAG," ims杩炴帴澶辫触"); if (imsConnectStatusCallback != null){ imsConnectStatusCallback.onConnectFailed(); } @@ -336,12 +337,12 @@ return; } try { - MyLog.i("PlatformMessage", "sendMsg: "+ BytesUtils.bytesToHexString(msg)); + MyLog.i(PlatFormConstant.TAG, "瀹㈡埛绔秷鎭紙杞箟鍚庯級锛�"+ BytesUtils.bytesToHexString(msg)); ByteBuf byteBuf = ByteBufAllocator.DEFAULT.ioBuffer(); byteBuf.writeBytes(msg); channel.writeAndFlush(byteBuf); } catch (Exception e) { - Log.i("PlatformMessage", "鍙戦�佹秷鎭け璐ワ紝reason="+e.getMessage()+"\t"+msg); + MyLog.i(PlatFormConstant.TAG, "瀹㈡埛绔彂閫佹秷鎭け璐ワ紝reason="+e.getMessage()+"\t"+msg); } } @@ -456,7 +457,7 @@ @Override public void run() { - MyLog.i(TAG, "鎵ц閲嶈繛浠诲姟"); + MyLog.i(PlatFormConstant.TAG, "鎵ц閲嶈繛浠诲姟"); if (!isFirst){ onConnectStatusCallback(IMSConfig.CONNECT_STATE_FAILURE); } @@ -536,7 +537,7 @@ if(connectStatus != IMSConfig.CONNECT_STATE_CONNECTING){ onConnectStatusCallback(IMSConfig.CONNECT_STATE_CONNECTING); } - MyLog.i( String.format("姝e湪杩涜connectServer銆�%s銆戠殑绗琜%d]杩炴帴锛屽綋鍓嶉噸杩炲欢鏃舵椂闀夸负[%dms]: ",serverUrl,j,j*getReconnectInterval())); + MyLog.i(PlatFormConstant.TAG, String.format("姝e湪杩涜connectServer銆�%s銆戠殑绗琜%d]杩炴帴锛屽綋鍓嶉噸杩炲欢鏃舵椂闀夸负[%dms]: ",serverUrl,j,j*getReconnectInterval())); try { currentPort = Integer.parseInt(address[1]); currentHost = address[0]; -- Gitblit v1.8.0