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

Add LevelAlias.Off; fixes #1684 #1910

Merged
merged 2 commits into from May 29, 2023
Merged

Conversation

nblumhardt
Copy link
Member

The question of what to do about turning logging completely off via a MinimumLevel.Override, and how to map MEL's LogLevel.Off in configuration, has been open for a long time.

The arguments against putting this on LogEventLevel center around Off not being a valid value to find attached to a LogEvent.

This PR is an attempt to side-step the issue via LevelAlias. Adding Off here doesn't sanction constructing an event with the Off level, but gives us and everyone else an indication that the Off value will be respected in minimum level overrides and JSON configuration (some downstream work required in Serilog.Settings.Configuration for this).

What do you think?

@sungam3r
Copy link
Contributor

👍 I like it.

Copy link
Member

@augustoproiete augustoproiete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@nblumhardt nblumhardt merged commit 3208c64 into serilog:dev May 29, 2023
1 check passed
@nblumhardt nblumhardt mentioned this pull request Jun 19, 2023
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

3 participants