Prechádzať zdrojové kódy

添加日志 review denny

fly 2 rokov pred
rodič
commit
000fffa1ef
2 zmenil súbory, kde vykonal 9 pridanie a 0 odobranie
  1. 4 0
      NotificationQueueManager.cs
  2. 5 0
      NotificationServer.cs

+ 4 - 0
NotificationQueueManager.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Concurrent;
+using WingServerCommon.Log;
 using WingServerCommon.Utilities.Executors;
 
 namespace WingNotificationModule
@@ -48,15 +49,18 @@ namespace WingNotificationModule
             /// <param name="messageParam"></param>
             public void Post(string msgQueueId, PostMessageParam messageParam)
             {
+                Logger.WriteLineInfo($"Post,msgQueueId:{msgQueueId},Token:{messageParam.Token},WSConnectType:{messageParam.WSConnectType},Message:{messageParam.Message}");
                 SequenceExecutor<PostMessageParam> postMsgExecutor = null;
 
                 if (!string.IsNullOrWhiteSpace(msgQueueId) && _notifyExecutorCollection.TryGetValue(msgQueueId, out postMsgExecutor) && postMsgExecutor != null)
                 {
                     postMsgExecutor.Add(_sendMessage, messageParam);
+                    Logger.WriteLineInfo($"postMsgExecutor.Add,msgQueueId:{msgQueueId},Token:{messageParam.Token},WSConnectType:{messageParam.WSConnectType},Message:{messageParam.Message}");
                 }
                 else if (_notifyExecutorCollection.TryGetValue(DefaultMessageQueueId, out postMsgExecutor) && postMsgExecutor != null)
                 {
                     postMsgExecutor.Add(_sendMessage, messageParam);
+                    Logger.WriteLineInfo($"postMsgExecutor.Add,msgQueueId:{msgQueueId},Token:{messageParam.Token},WSConnectType:{messageParam.WSConnectType},Message:{messageParam.Message}");
                 }
             }
         }

+ 5 - 0
NotificationServer.cs

@@ -252,6 +252,7 @@ namespace WingNotificationModule
         {
             try
             {
+                Logger.WriteLineInfo($"SendMessage start, Token:{param.Token},WSConnectType:{param.WSConnectType},Message:{param.Message}");
                 var wsConnectType = param.WSConnectType;
                 var token = param.Token;
                 //如果存在第二窗口连接则使用第二窗口连接,如果没有第二窗口连接则使用主连接发送消息
@@ -439,11 +440,13 @@ namespace WingNotificationModule
                     Logger.WriteLineWarn($"WebSocket is closed,message:{message}");
                     return false;
                 }
+                Logger.WriteLineWarn($"WebSocket is closed,message:{message}");
                 var adapter = new BufferAdapter(message);
                 var buffer = adapter.GetMessageBuffer();
                 try
                 {
                     await _webSocketIO.SendAsync(buffer, WebSocketMessageType.Binary);
+                    Logger.WriteLineInfo($"Send end, message:{message}");
                 }
                 catch (Exception ex)
                 {
@@ -466,11 +469,13 @@ namespace WingNotificationModule
                     Logger.WriteLineWarn($"WebSocket is closed,message:{message}");
                     return false;
                 }
+                Logger.WriteLineInfo($"Send start, message:{message}");
                 var adapter = new BufferAdapter(message);
                 var buffer = adapter.GetMessageBuffer();
                 try
                 {
                     _webSocketIO.Send(buffer, WebSocketMessageType.Binary);
+                    Logger.WriteLineInfo($"Send end, message:{message}");
                 }
                 catch (Exception ex)
                 {