本文整理汇总了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();
}