in src/Elastic.Serilog.Sinks/ConfigSinkExtensions.cs [80:131]
public static LoggerConfiguration ElasticCloud(
this LoggerSinkConfiguration loggerConfiguration,
BootstrapMethod bootstrapMethod,
Uri? endpoint = null,
string? cloudId = null,
string? apiKey = null,
string? username = null,
string? password = null,
string? dataStream = null,
string? ilmPolicy = null,
bool? includeHost = null,
bool? includeActivity = null,
bool? includeProcess = null,
bool? includeUser = null,
ICollection<string>? filterProperties = null,
int? maxRetries = null,
int? maxConcurrency = null,
int? maxInflight = null,
int? maxExportSize = null,
TimeSpan? maxLifeTime = null,
BoundedChannelFullMode? fullMode = null,
Uri? proxy = null,
string? proxyUsername = null,
string? proxyPassword = null,
string? fingerprint = null,
bool debugMode = false,
LoggingLevelSwitch? levelSwitch = null,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum
)
{
var transportConfig = (endpoint, cloudId, apiKey, username, password) switch
{
({ } s, null, _, _, _) => TransportHelper.Static(new[] { s }),
(null, { } id, { } k, _, _) => TransportHelper.Cloud(id, k),
(null, { } id, null, { } u, { } p) => TransportHelper.Cloud(id, u, p),
_ => throw new ArgumentException("Invalid cloud configuration")
};
SetTransportConfig(transportConfig, apiKey, username, password, proxy, proxyUsername, proxyPassword, fingerprint, debugMode);
var sinkOptions = CreateSinkOptions(transportConfig,
bootstrapMethod, dataStream, ilmPolicy, includeHost, includeActivity, includeProcess, includeUser, filterProperties
);
SetBufferOptions(sinkOptions, maxRetries, maxConcurrency, maxInflight, maxExportSize, maxLifeTime, fullMode);
return loggerConfiguration.Sink(new ElasticsearchSink(sinkOptions), restrictedToMinimumLevel, levelSwitch);
}