Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Long Do Thanh committed May 14, 2024
1 parent a89fcc0 commit 323d236
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/Hosting.Services/HostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ public static IServiceCollection AddOmexServiceFabricDependencies<TContext>(this

collection.AddLogging();

collection.TryAddTransient<IServiceContext, EmptyServiceContext>();
collection.TryAddTransient<IExecutionContext, BaseExecutionContext>();
collection.TryAddTransient<IExternalScopeProvider, LoggerExternalScopeProvider>();

#pragma warning disable OMEX188 // This method also adds Legacy OmexLogger and ActivityEventSender which are deprecated. They are pending for removal by 1 July 2024. Consider adding a different telemetry solution. DiagnosticId = "OMEX188"
return collection.AddOmexServices();
Expand Down
10 changes: 2 additions & 8 deletions src/Logging/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,14 @@ public static IServiceCollection AddOmexLogging(this IServiceCollection serviceC
serviceCollection.TryAddTransient<IExecutionContext, BaseExecutionContext>();
serviceCollection.TryAddTransient<IExternalScopeProvider, LoggerExternalScopeProvider>();

AddOmexLegacyLogging(serviceCollection);

return serviceCollection;
}

[Obsolete($"{nameof(OmexLogger)} and {nameof(OmexLogEventSource)} are obsolete and pending for removal by 1 July 2024. Please consider using a different Logger.", DiagnosticId = "OMEX188")]
private static void AddOmexLegacyLogging(IServiceCollection serviceCollection)
{
serviceCollection.TryAddSingleton(_ => OmexLogEventSource.Instance);
serviceCollection.TryAddSingleton<ILogEventReplayer, OmexLogEventReplayer>();
serviceCollection.TryAddSingleton<ILogEventSender, OmexLogEventSender>();

serviceCollection.TryAddEnumerable(ServiceDescriptor.Transient<IActivityStopObserver, ReplayableActivityStopObserver>());
serviceCollection.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, OmexLoggerProvider>());

return serviceCollection;
}
}
}

0 comments on commit 323d236

Please sign in to comment.