/// <summary> /// Add TomatoLog for Cosmos.Logging /// </summary> /// <param name="services"></param> /// <param name="settingAct"></param> /// <param name="configAct"></param> /// <returns></returns> public static ILogServiceCollection AddTomatoLog(this ILogServiceCollection services, Action <TomatoLogSinkOptions> settingAct = null, Action <IConfiguration, TomatoLogSinkConfiguration> configAct = null) { var settings = new TomatoLogSinkOptions(); settingAct?.Invoke(settings); return(services.AddTomatoLog(settings, configAct)); }
private static void RegisterTomatoLogClients(TomatoLogSinkOptions options, TomatoLogSinkConfiguration configuration) { //优先级判断: option > configuration if (options.RedisOptions == null && options.RabbitMqOptions == null && options.KafkaOptions == null) { RegisterClientViaConfiguration(configuration); } else { RegisterClientsViaOptions(options); } }
/// <summary> /// Add TomatoLog for Cosmos.Logging /// </summary> /// <param name="services"></param> /// <param name="sinkOptions"></param> /// <param name="configAct"></param> /// <returns></returns> public static ILogServiceCollection AddTomatoLog(this ILogServiceCollection services, TomatoLogSinkOptions sinkOptions, Action <IConfiguration, TomatoLogSinkConfiguration> configAct = null) { return(services.AddTomatoLog(Options.Create(sinkOptions), configAct)); }
private static void RegisterClientsViaOptions(TomatoLogSinkOptions options) { var client = TomatoLogClientCreator.Create(options); TomatoClientManager.Set(client, options.FlowType); }