public NekoLogMiddleware(RequestDelegate next, Action <NekoLogConfiguration> configuration) : this(next) { if (_logConfiguration == null) { _logConfiguration = new NekoLogConfiguration(); } configuration?.Invoke(_logConfiguration); }
/// <summary> /// 配置全局的日志注入 /// </summary> /// <param name="builder"></param> /// <param name="configurationAction">日志配置信息</param> /// <returns></returns> public static IHostBuilder BuildNekoLog(this IHostBuilder builder, Action <NekoLogConfiguration> configurationAction) { return(builder.ConfigureLogging(op => { op.ClearProviders(); NekoLogConfiguration logConfiguration = new NekoLogConfiguration(); configurationAction?.Invoke(logConfiguration); op.AddProvider(new NekoLogProvider(logConfiguration)); })); }