public static void LogDebug(this ILogger logger, CoreEventId eventId, Func <string> formatter) { if (logger.IsEnabled(LogLevel.Debug)) { logger.Log <object>(LogLevel.Debug, (int)eventId, null, null, (_, __) => formatter()); } }
public static void LogError <TState>( this ILogger logger, CoreEventId eventId, Func <TState> state, Exception exception, Func <Exception, string> formatter) { if (logger.IsEnabled(LogLevel.Error)) { logger.Log(LogLevel.Error, (int)eventId, state(), exception, (_, e) => formatter(e)); } }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> protected virtual void ShowWarning(CoreEventId eventId, [NotNull] string message) => Dependencies.Logger.LogWarning(eventId, () => message);
public static void LogWarning(this ILogger logger, CoreEventId eventId, Func <string> formatter) { // Always call Log for Warnings because Warnings as Errors should work even // if LogLevel.Warning is not enabled. logger.Log <object>(LogLevel.Warning, (int)eventId, eventId, null, (_, __) => formatter()); }