【发布时间】:2017-11-01 20:14:39
【问题描述】:
我刚刚开始在 Core 2 网络应用中使用 SeriLog,并将示例代码粘贴到我的控制器中:
_logger.LogInformation("Before");
using (_logger.BeginScope("Some name"))
using (_logger.BeginScope(42))
using (_logger.BeginScope("Formatted {WithValue}", 12345))
using (_logger.BeginScope(new Dictionary<string, object> { ["ViaDictionary"] = 100 }))
{
_logger.LogInformation("Hello from the Index!");
_logger.LogDebug("Hello is done");
}
_logger.LogInformation("After");
但输出排除了非平面文本的行:
2017-11-01 14:53:19.587 -05:00 [Information] Before
2017-11-01 14:53:19.588 -05:00 [Information] Hello from the Index!
2017-11-01 14:53:19.588 -05:00 [Debug] Hello is done
2017-11-01 14:53:19.588 -05:00 [Information] After
一方面这有点道理,但另一方面 - 为什么将它包含在 repos 示例代码中?
【问题讨论】:
标签: serilog