예제 #1
0
        public override void render(StreamWriter sw)
        {
            //縮排階層
            var identLevel = LogLevel > 1 ? LogLevel - 1 : 0;

            if (identLevel == 0)
            {
                sw.WriteLine("--執行緒{1} 日期 {0}", LogDate.ToString("yyyy/MM/dd HH:mm:ss.fff", CultureInfo.InvariantCulture), ThreadCode);
                sw.Write(LogContent);
                sw.WriteLine();
            }
            else
            {
                var sb = new StringBuilder();
                for (var i = 0; i < identLevel; i++)
                {
                    sb.Append("\t");
                }
                var tabstr = sb.ToString();
                sb.Length = 0;
                sb.AppendLine("--" + "".PadLeft(identLevel, '>'));
                sb.AppendFormat("--執行緒{1} 日期 {0}", LogDate.ToString("yyyy/MM/dd HH:mm:ss.fff", CultureInfo.InvariantCulture), ThreadCode);
                sb.AppendLine();
                sb.Append(LogContent);
                sb.AppendLine();
                var lines = sb.ToString().Replace("\r\n", "\n").Split('\n');
                sb.Length = 0;
                lines.forEach(x => { sb.Append(tabstr); sb.Append(x); sb.AppendLine(); });
                sw.Write(sb.ToString());
            }
        }
예제 #2
0
 public string PrintLong()
 {
     return(String.Format("{0} {1}{2} - {3}",
                          PersianLogType,
                          Title,
                          (Description != "" ? ": " + Description : ""),
                          PublicUtilities.ConvertDateTimeToJalali(LogDate) + " " + LogDate.ToString("HH:mm:ss")));
 }