本文整理匯總了C#中System.Exception.GetAllMessage方法的典型用法代碼示例。如果您正苦於以下問題:C# Exception.GetAllMessage方法的具體用法?C# Exception.GetAllMessage怎麽用?C# Exception.GetAllMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Exception
的用法示例。
在下文中一共展示了Exception.GetAllMessage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Write
public void Write(MessageLevel level, Exception ex)
{
if (this.MessageReceived == null) return;
MessageEventArgs msgArgs = new MessageEventArgs(level, ex.GetAllMessage());
this.MessageReceived(null, msgArgs);
}
示例2: LogOperator
/// <summary>
/// 記錄操作日誌
/// </summary>
/// <param name="module">所屬模塊</param>
/// <param name="action">操作類型</param>
/// <param name="content">操作內容</param>
/// <param name="ex">異常</param>
/// <returns></returns>
public static bool LogOperator(string module, BusinessAction action, string content, Exception ex)
{
var log = new OperatorLog() {
Module = module,
Action = action.ToString(),
ActionContent = content,
ActionTime = DateTime.Now,
IsSuccess = false
};
if (HttpContext.Current != null) {
var loginUser = SecurityContext.User;
if (loginUser != null) {
log.Actor = loginUser.LoginId + "|" + loginUser.Name;
}
}
log.ExceptionType = ex.GetType().ToString();
log.ExceptionMsg = ex.GetAllMessage();
return log.Save();
}