示例#1
0
        public void LogMessage(string message, Exception exception, string user = "******", LogMessageType logMessageType = LogMessageType.Trace, Common.Models.LogLevel logLevel = Common.Models.LogLevel.Error)
        {
            message = message + " " + exception.Message + " " + exception.StackTrace;

            if (logMessageType == LogMessageType.Trace)
            {
                logTraceBuilder.AppendLine(string.Format(" {0} {1} {2}  {3}", logLevel, user, DateTime.Now, message));
            }
            else
            {
                logPIIBuilder.AppendLine(string.Format(" {0} {1} {2}  {3}", logLevel, user, DateTime.Now, message));
            }

            if (exception.InnerException != null)
            {
                LogMessage("", exception.InnerException, user, logMessageType, logLevel);
            }
        }
示例#2
0
 public void LogMessage(string message, string user = "******", LogMessageType logMessageType = LogMessageType.Trace, Common.Models.LogLevel logLevel = Common.Models.LogLevel.Info)
 {
     if (logMessageType == LogMessageType.Trace)
     {
         logTraceBuilder.AppendLine(string.Format(" {0} {1} {2} {3}", logLevel, user, DateTime.Now, message));
     }
     else
     {
         logPIIBuilder.AppendLine(string.Format(" {0} {1} {2}  {3}", logLevel, user, DateTime.Now, message));
     }
 }