Closed merodriguezblanco closed 8 months ago
Attributes as well as destructuring policy work for your logged objects to construct LogEvent
that will be passed to configured sinks. So there is no direct relations between attributes you are talking about and sinks. You may try to create different loggers from different instances of LoggerConfiguration
. Something like appsettingsForFile.json
and appSettingsForConsole.json
and read them separately.
@sungam3r thanks for the response. I'm not sure I follow. My plan is to be able to log certain attributes to file but mask them when logging to console (using serilog + destructurama). I wasn't able to do that using LogMasked
because this always mask the attribute regardless of logging to file or console. I'm using appsettings.json
to configure where to write to and defining the templates to log.
because this always mask the attribute regardless of logging to file or console
Yes. This is by design. That is the thing I was talking about. Serilog works like this:
So there is only one single message (event) for all sinks. You can achieve what you want with some hacks around Serilog design, but I would not try to describe them.
This issue was marked as stale since it has not been active for a long time
Closed as answered.
Hi there, thanks for this amazing library!
I was wondering how I can configure it so that I can mask attributes only for a specific sink. My log configuration is set up to write to console and to file (via the appsettings.json). However, I need to mask the attributes only when logging to file, but not when logging to the console.
I would appreciate any suggestion for this.