Exemple #1
0
		public static void Log(LogInfo info)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine();
            sb.AppendFormat("({0}) {1} {2} ({3}) {4}", info.ThreadId,
                         info.Time.ToShortDateString(), info.Time.ToLongTimeString(),
                         info.Level, info.Message);

            AppendToTextBox(sb.ToString());
        }
Exemple #2
0
		private static void Log(LogLevel level, Exception e, string message, params object[] formatArgs)
		{
			if (String.IsNullOrEmpty(message))
				return;

			StringBuilder builder = new StringBuilder();
			builder.AppendFormat(message, formatArgs);
			if (e != null)
			{
				builder.AppendLine();
				builder.Append(e);
			}

			LogInfo info = new LogInfo();
			info.Level = level;
			info.Message = builder.ToString();
			info.ThreadId = Thread.CurrentThread.ManagedThreadId;
			info.Time = DateTime.Now;

			Log(info);
		}