Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifiers registered through Dependency Injection (proposal #183) #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

freerider75
Copy link

commit a3c00474c005f633f35fc285b4b01b486f6bc7e5
Author: Alessandro Poy freerider75@users.noreply.github.com
Date: Tue Nov 21 16:10:51 2023 +0100

Have IErrorNotifier served by DI

#183

commit a3c00474c005f633f35fc285b4b01b486f6bc7e5
Author: Alessandro Poy <freerider75@users.noreply.github.com>
Date:   Tue Nov 21 16:10:51 2023 +0100

    Have IErrorNotifier served by DI

    ElmahCore#183
@freerider75
Copy link
Author

With this change the error notifiers are removed from options and handled by dependency injection.
An example of the new way of configuring error notifiers:

builder.Services.AddTransient<IErrorNotifier, MyNotifier>();  // <-- just add one or more IErrorNotifier registrations, they will be passed to ErrorLogMiddleware
builder.Services.AddElmah<XmlFileErrorLog>(options =>
{
    options.LogPath = "~/log";
    options.Filters.Add(new CmsErrorLogFilter());
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant