You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.Message
- {
- public class MessageLog
- {
- private volatile static MessageLog _Instance;
- public static MessageLog GetInstance => _Instance ?? (_Instance = new MessageLog());
- private MessageLog() { }
-
- #region 普通消息日志
- /// <summary>
- /// 日志显示委托
- /// </summary>
- public Action<string> InfoNotify { get; set; }
-
- /// <summary>
- /// 日志信息
- /// </summary>
- public string LogInfo { get; set; } = string.Empty;
-
- /// <summary>
- /// 普通日志输出
- /// </summary>
- /// <param name="info"></param>
- public void Show(string info)
- {
- Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}");
- LogInfo = $"{DateTime.Now.ToString("HH:mm:ss")}:{info} \n\r {LogInfo}";
- if (InfoNotify != null) InfoNotify(info);
- }
- #endregion
-
- #region 异常消息日志
- /// <summary>
- /// 异常日志委托
- /// </summary>
- public Action<string> ExInfoNotify { get; set; }
-
- /// <summary>
- /// 异常日志信息
- /// </summary>
- public string ExLogInfo { get; set; } = string.Empty;
-
- /// <summary>
- /// 异常日志输出
- /// </summary>
- /// <param name="info"></param>
- public void ShowEx(string info)
- {
- Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}");
- ExLogInfo = $"{DateTime.Now.ToString("HH:mm:ss")}:{info} \n\r {ExLogInfo}";
- if (ExInfoNotify != null) ExInfoNotify(info);
- }
- #endregion
-
-
-
-
-
- }
- }
|