Major upgrade
This commit is contained in:
29
Source/UnitTests/Common/Util.cs
Normal file
29
Source/UnitTests/Common/Util.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UnitTests
|
||||
{
|
||||
public class Util
|
||||
{
|
||||
public static void LogException(Exception ex, ILogger logger)
|
||||
{
|
||||
string errorMsg = ex.Message;
|
||||
string stackTrace = ex.StackTrace;
|
||||
|
||||
Exception innerEx = ex.InnerException;
|
||||
while (innerEx != null)
|
||||
{
|
||||
errorMsg = innerEx.Message;
|
||||
stackTrace = innerEx.StackTrace + "\r\n" + stackTrace;
|
||||
|
||||
innerEx = innerEx.InnerException;
|
||||
}
|
||||
|
||||
logger.Error(errorMsg + "\r\n" + stackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user