【发布时间】:2017-12-31 22:16:26
【问题描述】:
有没有办法将 Serilog 格式的结构化数据转换为格式化输出?
我最近一直在 Serilog 中使用结构化数据结构,尽管它的优点是紧凑的大型数据结构(5 个或更多属性)很难在控制台/文件中读取而不稍后对其进行格式化。
假设我只会在 dev 上启用它。
https://github.com/serilog/serilog/wiki/Structured-Data
从这里:
{ "Fruit": ["Apple", "Pear", "Orange"] }
到这里:
{
"Fruit": [
"Apple",
"Pear",
"Orange"
]
}
编辑:
目前我正在使用JsonConvert.SerializeObject({...}, Formatting.Indented),但出于控制台包的正确着色、更快的序列化、延迟序列化等原因,我想摆脱它。
【问题讨论】:
-
你有没有得到任何地方?
标签: c# logging asp.net-core .net-core serilog