本文整理匯總了C#中System.Exception.Log方法的典型用法代碼示例。如果您正苦於以下問題:C# Exception.Log方法的具體用法?C# Exception.Log怎麽用?C# Exception.Log使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Exception
的用法示例。
在下文中一共展示了Exception.Log方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: HandleException
protected ViewResult HandleException(string viewName, object model, Exception exc)
{
exc.Log();
ViewBag.Container = model;
this.ModelState.AddModelError("_Form", (this.Request.IsLocal) ?
exc.Message : "An unknown error has occurred.");
return View(viewName, model);
}
示例2: hubConnection_Error
static void hubConnection_Error(Exception obj)
{
obj.Log("Signalr connection issue");
if (obj is UnauthorizedAccessException || obj.InnerException is UnauthorizedAccessException)
{
Logging.DebugMessage("Token expiry... refreshing oauth token");
try
{
hubConnection.Stop();
}
catch (Exception)
{
// ignored
}
hubConnection.Dispose();
ConfigCacheHelper.SetCredentials(hubConnection);
hubConnection.Start();
}
}
示例3: ToConsole
public void ToConsole(Exception e)
{
if (e == null)
{
return;
}
lock (VitaNexCore.ConsoleLock)
{
Console.Write('[');
Utility.PushColor(ConsoleColor.Green);
Console.Write(Name);
Utility.PopColor();
Console.Write("]: ");
Utility.PushColor(ConsoleColor.DarkRed);
Console.WriteLine((Quiet && !Debug) ? e.Message : e.ToString());
Utility.PopColor();
}
if (Debug)
{
e.Log(IOUtility.EnsureFile(VitaNexCore.LogsDirectory + "/Debug/" + TypeOf.FullName + ".log"));
}
}
示例4: HandleError
public bool HandleError(Exception error)
{
error.Log();
return false;
}
示例5: PrintLuaStackTrace
internal static void PrintLuaStackTrace(Exception e)
{
var data = LuaExceptionData.GetData(e);
if (data != null)
{
foreach (var frame in data)
{
e.Log().Error(frame.ToString());
}
}
}