Beispiel #1
0
 public static void Info(CoreMethodInfo methodInfo, LogDomain domain, object returnValue, params string[] messages)
 {
     NAction.BeginInvoke(IpBase.GetIp(), methodInfo, domain, LogType.Info, returnValue, messages, null, null);
 }
Beispiel #2
0
 private static void Log(string ip, CoreMethodInfo methodInfo, LogDomain domain, LogType logtype, object returnValue, params string[] messages)
 {
     var log = LoggerConfig.Instance.GetLogger(domain);
     try
     {
         var message = new StringBuilder();
         message.Append("[" + ip + "][" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "]");
         message.Append("\t\n");
         if (methodInfo.ParamList != null && methodInfo.ParamList.Count > 0)
         {
             message.Append("param:");
             message.Append(methodInfo.ParamList.ToJson());
             message.Append("\t\n");
         }
         if (!string.IsNullOrEmpty(methodInfo.Address))
         {
             message.Append("address:");
             message.Append(methodInfo.Address);
             message.Append("\t\n");
         }
         if (returnValue != null)
         {
             message.Append("Result:");
             message.Append(returnValue.ToJson());
             message.Append("\t\n");
         }
         if (messages.Length > 0) message.Append(string.Join("\t\n", messages) + "\t\n");
         switch (logtype)
         {
             case LogType.Error:
                 log.Error(message);
                 break;
             case LogType.Debug:
                 log.Debug(message);
                 break;
             case LogType.Info:
                 log.Info(message);
                 break;
         }
     }
     catch (Exception ex)
     {
         Error(MethodBase.GetCurrentMethod(), domain, logtype, null, string.Empty, ex.ToString());
     }
 }