Skip to content
This repository was archived by the owner on Feb 27, 2022. It is now read-only.

Adds LoggingFilterSwitch #2

Merged
merged 1 commit into from
Jan 30, 2017

Conversation

nblumhardt
Copy link
Collaborator

Runtime filtering control.

var @switch = new LoggingFilterSwitch();
var sink = new CollectingSink();

var log = new LoggerConfiguration()
    .Filter.ControlledBy(@switch)
    .WriteTo.Sink(sink)
    .CreateLogger();

// Written
log.Information("Adding {Volume} L", 11);

@switch.Expression = "Volume > 12";

// Not written
log.Information("Adding {Volume} L", 11);

@nblumhardt
Copy link
Collaborator Author

Hey folks; a second set of eyes on this would be great, but since we're in pre-release mode I'll push it through. Cheers!

@nblumhardt nblumhardt merged commit 6b0778b into serilog-archive:dev Jan 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant