destructurama / attributed

Use attributes to control how complex types are logged to Serilog.
Apache License 2.0
263 stars 32 forks source link

Ability to add [NotLogged] but configure for the Microsoft ILogger/SerilogILogger logging levels #120

Open bensmith009988 opened 3 months ago

bensmith009988 commented 3 months ago

It would be really nice to have a configurable option on all of the types of ignorable attributes for ignoring properties within a log, but be able to specify that they are ignore from "this logging level and up." We have certain fields on our models we only want to log, when the ILogger logging level is logging this object at say Information and below, for example. This is because we have different logging specifications for different environments, and we only want to log (say passwords and authentication tokens for example) when the app is configured to run in debug mode.

github-actions[bot] commented 2 months ago

This issue was marked as stale since it has not been active for a long time

mobilebilly commented 2 weeks ago

FYI, The log level is not currently accessible by the IDestructingPolicy which is discussed here https://github.com/serilog/serilog/issues/2105

So the enhancement is not possible at the moment