-
Notifications
You must be signed in to change notification settings - Fork 33
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
Restrict to level #45
Comments
Hi Joseph, this should work for you: Log.Logger = new LoggerConfiguration()
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(evt => evt.Level == LogEventLevel.Error)
.WriteTo.RollingFile("errors.txt"))
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(evt => evt.Level == LogEventLevel.Warning)
.WriteTo.RollingFile("warnings.txt"))
.CreateLogger(); How's that fit? Cheers! |
Nice, that should do it! On a side note, do you have any up for grabs issues that are suitable for someone new to Serilog? I'd love to contribute if I could, Serilog is an awesome library! |
Great, thanks for the interest! There are a lot of repositories spread around the organisation with a few up-for-grabs item in there. If you're interested in Linux and Win 10, I think serilog-archive/serilog-sinks-literate#9 would be a fun one? |
Hi,
What's the best approach to restricting a log to a certain level? I see
RollingFile
has arestrictToMinimumLevel
parameter, but if I wish to restrict the log data to only errors then I can't see this being an option. I recall there being a filter API which seems like it would be the next best thing.Alternatively could you see much value in having a
restrictToLevel
property available on the method?The text was updated successfully, but these errors were encountered: