public static IServiceCollection AddModelLogging(this IServiceCollection services, Action <ModelLoggingOptions> config = null) { if (services == null) { throw new ArgumentNullException(nameof(services)); } var options = new ModelLoggingOptions(); config?.Invoke(options); return(AddModelLogging(services, options)); }
public static IServiceCollection AddModelLogging(this IServiceCollection services, ModelLoggingOptions options) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } services.AddSingleton(options); services.AddSingleton <ILogger, Logger>(); return(services); }