:zap:优化Nlog日志记录,解决记录到文本IP、请求地址获取不到问题

This commit is contained in:
不做码农
2023-09-07 09:34:01 +08:00
parent 02ffc18a61
commit b01765360d
6 changed files with 50 additions and 27 deletions
@@ -5,9 +5,19 @@ namespace Infrastructure
public class CustomException : Exception
{
public int Code { get; set; }
/// <summary>
/// 前端提示语
/// </summary>
public string Msg { get; set; }
/// <summary>
/// 记录到日志的详细内容
/// </summary>
public string LogMsg { get; set; }
/// <summary>
/// 是否通知
/// </summary>
public bool Notice { get; set; } = true;
public CustomException(string msg) : base(msg)
{
}
@@ -17,9 +27,10 @@ namespace Infrastructure
Msg = msg;
}
public CustomException(ResultCode resultCode, string msg) : base(msg)
public CustomException(ResultCode resultCode, string msg, bool notice = true) : base(msg)
{
Code = (int)resultCode;
Notice = notice;
}
/// <summary>