-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add support for binding FormatterOptions from config file #124176
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
Merged
mrek-msft
merged 14 commits into
dotnet:main
from
mrek-msft:dev/mrek/mel-eventlog-bind-conf
Feb 12, 2026
+95
−0
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a48e354
Add support for binding FormatterOptions from config file.
mrek-msft f24d368
Do not require FormatterOptions configuration section nesting.
mrek-msft 0952641
Clenup after removal need for FormatterOptions scope
mrek-msft 6a22c03
Revert whitespace BOM change
mrek-msft 347410b
Fix grammar in comment
mrek-msft dd1411a
Add missing InterceptorsPreviewNamespaces
mrek-msft 4087eaf
Apply suggestions from code review
tarekgh fcc0be2
Apply suggestions from code review
tarekgh 936c607
Update src/libraries/Microsoft.Extensions.Logging.EventLog/src/EventL…
tarekgh b6e1ec3
Fix EventLog configuration binding: add AddConfiguration(), IOptionsC…
tarekgh 3ebb335
Fix XML remarks comment and add configuration binding tests
tarekgh 6e1b9a7
Merge branch 'dev/mrek/mel-eventlog-bind-conf' of https://github.com/…
mrek-msft 6a7b989
Target copilot PR comment: rename settings to options.
mrek-msft 31eea2c
Remove property duplication in the csproj
tarekgh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/libraries/Microsoft.Extensions.Logging.EventLog/src/EventLogConfigureOptions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Runtime.Versioning; | ||
| using Microsoft.Extensions.Configuration; | ||
| using Microsoft.Extensions.Logging.Configuration; | ||
| using Microsoft.Extensions.Logging.EventLog; | ||
| using Microsoft.Extensions.Options; | ||
|
|
||
| namespace Microsoft.Extensions.Logging | ||
| { | ||
| /// <summary> | ||
| /// Configures an EventLogSettings object from an IConfiguration. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Uses source-generated configuration binding to allow ConfigurationBinder, and all its dependencies, | ||
| /// to be trimmed. This improves app size and startup. | ||
| /// </remarks> | ||
| internal sealed class EventLogConfigureOptions : IConfigureOptions<EventLogSettings> | ||
| { | ||
| private readonly IConfiguration _configuration; | ||
|
|
||
| [UnsupportedOSPlatform("browser")] | ||
| public EventLogConfigureOptions(ILoggerProviderConfiguration<EventLogLoggerProvider> providerConfiguration) | ||
| { | ||
| _configuration = providerConfiguration.Configuration; | ||
| } | ||
|
|
||
| public void Configure(EventLogSettings options) => _configuration.Bind(options); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.