文字列以外のデータをoutputingない:SeriLogは、私はちょうど、コア2のWebアプリで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サンプルコードにそれを組み込むのですか?
'{Scope}'ではなく、{{Properties} 'を出力テンプレートに含めることもできます。これは 'Scope'が存在するときだけでなく、引用された段落で提案された他のキー値のプロパティも表示します。乾杯! :-) –