public static void Extended(this ILogger logger, LogLevel logLevel, string message, object logProperties, Exception ex = null, string exceptionTag = null) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (ex == null) { ExtendedWithException(logger, logLevel, message, logProperties, null, 0, 0, null); } else if (ex.InnerException == null) { ExtendedWithException(logger, logLevel, message, logProperties, ex, 1, 1, null); } else { var allExceptions = ConvertException.ToList(ex); if (string.IsNullOrEmpty(exceptionTag)) { exceptionTag = Guid.NewGuid().ToString(); } for (var index = 0; index < allExceptions.Count; index++) { ExtendedWithException(logger, logLevel, message, logProperties, allExceptions[index], index + 1, allExceptions.Count, exceptionTag); } } }
public static void Extended(this ILogger logger, LogLevel logLevel, string message, object logProperties, Exception ex = null) { if (ex == null) { ExtendedWithException(logger, logLevel, message, logProperties, null, 0, 0, null); } else if (ex.InnerException == null) { ExtendedWithException(logger, logLevel, message, logProperties, ex, 1, 1, null); } else { var allExceptions = ConvertException.ToList(ex); var tag = Guid.NewGuid().ToString(); for (var index = 0; index < allExceptions.Count; index++) { ExtendedWithException(logger, logLevel, message, logProperties, allExceptions[index], index + 1, allExceptions.Count, tag); } } }