❔ Serilog: how to write a file for single level
Hi guys! I've been asked to write log levels Information, Warning and Error in development, but each of them in one separated file, so that I have information.txt containing only Information logs, warning.txt containing only Warning logs, Error.txt containing only Error logs.
This is my implementation at the moment (it works):
In Program.cs:
in appsettings:
I have installed Serilog.Expressions package and read the docs, I know I have to use something like this
but I can't understand where it should be placed. I've tried placing it in Args or between Args and Name but it doesn't work, can somebody help me? 🥺
3 Replies
you can definately do it with filters, which is a serilog plugin
ah, there was another section of the post 😄 Yeah, expression filters, thats what you need
it should be something like
I've tried in this exact way and it didn't work, I'm going crazy beacause it seems to be SO SIMPLE
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.