private static void WriteMessage( ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, object contextData, string message, object[] args) { Ensure.Any.IsNotNull(logger, nameof(logger)); Ensure.Any.IsNotNull(exception, nameof(exception)); if (contextData != null) { exception.AddContextData(contextData); } logger.Log(logLevel, eventId, exception, message, args); }