示例#1
0
        /// <summary>
        /// NLogから呼ばれるUI向けログ出力
        /// </summary>
        /// <param name="dateTime">日付</param>
        /// <param name="level">ログレベル</param>
        /// <param name="callsite">callsite</param>
        /// <param name="message">メッセージ</param>
        public static void AppendLog(
            string dateTime,
            string level,
            string callsite,
            string message)
        {
            DateTime d;

            DateTime.TryParse(dateTime, out d);

            var entry = new AppLogEntry()
            {
                DateTime = d,
                Level    = level,
                CallSite = callsite,
                Message  = message,
            };

            lock (AppLog.locker)
            {
                if (AppLog.logBuffer.Count > LogBufferSize)
                {
                    AppLog.logBuffer.RemoveRange(0, LogBufferMargin);
                }

                AppLog.logBuffer.Add(entry);
            }

            WPFHelper.BeginInvoke(() =>
                                  AppLog.OnAppendedLog(new AppendedLogEventArgs(entry)));
        }
 public AppendedLogEventArgs(AppLogEntry e)
 {
     this.AppendedLogEntry = e;
 }