public static IApplicationBuilder UseEFCoreSlowQuery(this IApplicationBuilder app, Action <EFCoreSlowQueryOptions> optionsAction) { if (optionsAction == null) { throw new ArgumentNullException(); } var options = new EFCoreSlowQueryOptions(); optionsAction.Invoke(options); var logger = app.CreateLogger(); RegisterObserver(logger, options); return(app); }
private static void RegisterObserver(ILogger logger, EFCoreSlowQueryOptions options) { var slowQueryObserver = new SlowQueryObserver(logger, options); DiagnosticListener.AllListeners.Subscribe(new EFCoreObserver(slowQueryObserver)); }
public SlowQueryObserver(ILogger logger, EFCoreSlowQueryOptions options) { _logger = logger; _options = options; }