1
私のAPIプロジェクト内でカスタムセントリシンクを作成しました。asp.netコア2.0のカスタムserilogシンクの設定をappsetings.jsonから読み取る方法
public class SentrySink : ILogEventSink {...}
私はロギング設定を通じて私のシンク を接続できるように、私も自分のシンクの拡張メソッドを作成しました。
public static LoggerConfiguration Sentry(this LoggerSinkConfiguration loggerConfiguration,
string dsn,
string release = null,
string environment = null,
LogEventLevel restrictedToMinimumLevel = LogEventLevel.Information,
IFormatProvider formatProvider = null)
{...}
私はすべてが正常に動作してのは見張りにあるログイン
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.WriteTo.Sentry(configuration["Sentry:Dsn"], restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Error)
を使用しています。私はLoggerConfigurationで設定を定義することなく
"WriteTo": [
{ "Name": "Sentry" }, ...
としてappsetting.jsonで構成を設定するとき
しかし、ログのが歩哨に送信されません。
私はappsetting.jsonからconfigsを使用できるように何かを実装する必要がありますか?おかげさまで