Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
Long Do Thanh committed May 22, 2024
1 parent b26d51e commit 149b272
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
10 changes: 2 additions & 8 deletions src/Logging/OmexLoggingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,8 @@ internal class OmexLoggingOptions
public uint MaxReplayedEventsPerActivity { get; set; } = 1000;

/// <summary>
/// Enable or disable OmexLogEventSender to forward log to an event source
/// Enable or disable OmexLogger
/// </summary>
public bool OmexLogEventSenderEnabled { get; set; } = false;

/// <summary>
/// OmexLoggerPath
/// </summary>
public static string OmexLoggingOptionPath = "Logging.Omex.Options";

public bool OmexLoggerEnabled { get; set; } = false;
}
}
1 change: 0 additions & 1 deletion src/Logging/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public static IServiceCollection AddOmexLogging(this IServiceCollection serviceC
<IOptionsChangeTokenSource<OmexLoggingOptions>,
LoggerProviderOptionsChangeTokenSource<OmexLoggingOptions, OmexLoggerProvider>>());


return serviceCollection;
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Logging.UnitTests/OmexLoggerProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public void CreateLogger_PropagatesCategory(bool omexLoggerEnabled)
Mock<ILogEventSender> mockEventSource = new();
IExternalScopeProvider mockExternalScopeProvider = new Mock<IExternalScopeProvider>().Object;

Mock<IOptionsMonitor<OmexLoggingOptions>> mockOmexLoggingOption = new();
Mock<IOptions<OmexLoggingOptions>> mockOmexLoggingOption = new();
OmexLoggingOptions omexLoggingOptions = new OmexLoggingOptions();
omexLoggingOptions.OmexLoggerEnabled = omexLoggerEnabled;
mockOmexLoggingOption.Setup(m => m.CurrentValue).Returns(omexLoggingOptions);
mockOmexLoggingOption.Setup(m => m.Value).Returns(omexLoggingOptions);

ILoggerProvider loggerProvider = new OmexLoggerProvider(mockEventSource.Object, mockExternalScopeProvider, Array.Empty<ILogScrubbingRule>(), mockOmexLoggingOption.Object);
ILogger logger = loggerProvider.CreateLogger(testCategory);
Expand Down

0 comments on commit 149b272

Please sign in to comment.