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.
35 lines
1001 B
35 lines
1001 B
using System; |
|
using System.Collections.Generic; |
|
using System.Text; |
|
|
|
namespace WeiCloud.Core.BaseModels |
|
{ |
|
public class LoggerWarp |
|
{ |
|
private readonly string _actionName; |
|
private readonly string _message; |
|
private readonly Exception _ex; |
|
|
|
public LoggerWarp(string actionName, string message = "", Exception ex = null) |
|
{ |
|
_actionName = actionName; |
|
_message = message; |
|
_ex = ex; |
|
} |
|
|
|
public string GetMessage() |
|
{ |
|
StringBuilder messageString = new StringBuilder(); |
|
messageString.Append(_actionName).Append("|"); |
|
if (!string.IsNullOrEmpty(_message)) |
|
{ |
|
messageString.Append(_message).Append("|"); |
|
} |
|
if (_ex != null) |
|
{ |
|
messageString.Append($"抛出了异常信息:{_ex.Message} {_ex.StackTrace} {_ex.Source}"); |
|
} |
|
return messageString.ToString(); |
|
} |
|
} |
|
} |