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); } } }