Skip to content

Commit

Permalink
Merge branch 'otlp-logs-options-di' of https://github.com/CodeBlanch/…
Browse files Browse the repository at this point in the history
…opentelemetry-dotnet into otlp-logs-options-di
  • Loading branch information
Yun-Ting committed Nov 15, 2023
2 parents 5b987c8 + 3b00b5f commit 9f46d13
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,12 @@ public void VerifyAddProcessorOverloadWithImplementationFactory()
{
// arrange
var services = new ServiceCollection();

services.AddSingleton<MyProcessor>();

var serviceCollection = services.AddLogging(logging =>
logging.AddOpenTelemetry(options =>
options.AddProcessor(sp => sp.GetRequiredService<MyProcessor>())));
services.AddLogging(logging =>
logging.AddOpenTelemetry(
o => o.AddProcessor(sp => sp.GetRequiredService<MyProcessor>())));

// act
using var sp = services.BuildServiceProvider();
Expand All @@ -156,14 +157,11 @@ public void VerifyAddProcessorOverloadWithImplementationFactory()
public void VerifyExceptionIsThrownWhenImplementationFactoryIsNull()
{
// arrange
Func<IServiceProvider, BaseProcessor<LogRecord>>? implementationFactory = null;
var services = new ServiceCollection();
#pragma warning disable CS8604 // Suppressed possible null reference warning for testing argument null exception.
_ = services.AddLogging(logging =>

services.AddLogging(logging =>
logging.AddOpenTelemetry(
o =>
o.AddProcessor(implementationFactory)));
#pragma warning restore CS8604 // Suppressed possible null reference warning for testing argument null exception.
o => o.AddProcessor(implementationFactory: null!)));

// act
using var sp = services.BuildServiceProvider();
Expand Down

0 comments on commit 9f46d13

Please sign in to comment.