在 Serilog 中使用
@
字符解构复杂对象时,默认使用“:”(冒号)作为分隔字符。我希望它是“=”(等号)。这可能吗?
using Serilog;
using Serilog.Events;
public class myClass
{
public void myMethod()
{
var logger = new LoggerConfiguration().WriteTo().EventLog("myapp");
var myComplexObject = new
{
property1 = "prop1",
property2 = "prop2"
};
logger.Information("{@complex}", myComplexObject);
}
}
输出:
{ complex:{ property1:"prop1", property2:"prop2" }}
所需输出:
{ complex:{ property1="prop1", property2="prop2" }}
这可能吗?