[英]Use current Serilog ILogger instance to format a message into a string (but not print it)
[英]ILogger not returning Message and Object in JSON format
我試圖通過以下方式使用ILogger,
_logger.LogInformation("Logging info {someClass}", someClass);
但是輸出只是對象名稱。
我在這里做錯了什么?
您可能想將類分解為屬性。
這是選擇加入的,可以使用@
啟用
所以
_logger.LogInformation("Logging info {@someClass}", someClass);
另請參閱: 如何使用結構化日志記錄和消息模板規范
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.