Skip to content

Commit

Permalink
useSniffing parameter handling was flipped (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz authored Sep 23, 2024
1 parent 9ec7e0c commit ec6774c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Elastic.Serilog.Sinks/ConfigSinkExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static LoggerConfiguration Elasticsearch(
this LoggerSinkConfiguration loggerConfiguration,
BootstrapMethod bootstrapMethod,
ICollection<Uri> nodes,
bool useSniffing = true,
bool useSniffing = false,
string? dataStream = null,
string? ilmPolicy = null,
string? apiKey = null,
Expand Down Expand Up @@ -58,7 +58,7 @@ public static LoggerConfiguration Elasticsearch(
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum
)
{
var transportConfig = !useSniffing ? TransportHelper.Static(nodes) : TransportHelper.Sniffing(nodes);
var transportConfig = useSniffing ? TransportHelper.Sniffing(nodes) : TransportHelper.Static(nodes);
SetTransportConfig(transportConfig, apiKey, username, password, proxy, proxyUsername, proxyPassword, fingerprint, debugMode
);

Expand Down
8 changes: 4 additions & 4 deletions src/Elastic.Serilog.Sinks/ElasticsearchSinkExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public static LoggerConfiguration Elasticsearch(
ICollection<Uri> nodes,
Action<ElasticsearchSinkOptions>? configureOptions = null,
Action<TransportConfiguration>? configureTransport = null,
bool useSniffing = true,
bool useSniffing = false,
LoggingLevelSwitch? levelSwitch = null,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum
)
{
var transportConfig = useSniffing ? TransportHelper.Static(nodes) : TransportHelper.Sniffing(nodes);
var transportConfig = useSniffing ? TransportHelper.Sniffing(nodes) : TransportHelper.Static(nodes) ;
configureTransport?.Invoke(transportConfig);

var sinkOptions = new ElasticsearchSinkOptions(new DistributedTransport(transportConfig));
Expand All @@ -73,12 +73,12 @@ public static LoggerConfiguration Elasticsearch<TEcsDocument>(
ICollection<Uri> nodes,
Action<ElasticsearchSinkOptions<TEcsDocument>>? configureOptions = null,
Action<TransportConfiguration>? configureTransport = null,
bool useSniffing = true,
bool useSniffing = false,
LoggingLevelSwitch? levelSwitch = null,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum
) where TEcsDocument : EcsDocument, new()
{
var transportConfig = useSniffing ? TransportHelper.Static(nodes) : TransportHelper.Sniffing(nodes);
var transportConfig = useSniffing ? TransportHelper.Sniffing(nodes) : TransportHelper.Static(nodes);
configureTransport?.Invoke(transportConfig);
var sinkOptions = new ElasticsearchSinkOptions<TEcsDocument>(new DistributedTransport(transportConfig));
configureOptions?.Invoke(sinkOptions);
Expand Down

0 comments on commit ec6774c

Please sign in to comment.