我想截取serilog即将写入的日志,并根据某种逻辑对其进行修改,即在日志中查找一些敏感信息并对其进行掩蔽。
到目前为止,我所能达到的最接近的方法就是找到ILogEventEnricher
public class LogEnricher : ILogEventEnricher
{
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
{
//do something here, but what?
}
}
但是LogEvent的属性MessagTemplate是只读的。是否知道如何截取日志并在日志记录之前修改它们。
https://stackoverflow.com/questions/55099799
复制相似问题