Skip to content

Commit

Permalink
Pass ILoggerFactory into LoadByAssemblyNameOrPath instead of ILogger
Browse files Browse the repository at this point in the history
  • Loading branch information
dmgonch committed Nov 20, 2019
1 parent 39e025f commit 65899df
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/OmniSharp.Abstractions/Services/IAssemblyLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ public static Assembly LoadByAssemblyNameOrPath(
}
}

public static IEnumerable<Assembly> LoadByAssemblyNameOrPath(this IAssemblyLoader loader, ILogger logger, IEnumerable<string> assemblyNames)
public static IEnumerable<Assembly> LoadByAssemblyNameOrPath(this IAssemblyLoader loader, ILoggerFactory loggerFactory, IEnumerable<string> assemblyNames)
{
var logger = loggerFactory.CreateLogger<IAssemblyLoader>();
foreach (var assemblyName in assemblyNames)
{
Assembly assembly;
Expand Down
3 changes: 1 addition & 2 deletions src/OmniSharp.Http/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
var plugins = _commandLinePlugins.AssemblyNames.Concat(options.CurrentValue.Plugins.GetNormalizedLocationPaths(_environment));

var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
var logger = loggerFactory.CreateLogger<Startup>();
var assemblyLoader = serviceProvider.GetRequiredService<IAssemblyLoader>();
_compositionHost = new CompositionHostBuilder(serviceProvider)
.WithOmniSharpAssemblies()
.WithAssemblies(assemblyLoader.LoadByAssemblyNameOrPath(logger, plugins).ToArray())
.WithAssemblies(assemblyLoader.LoadByAssemblyNameOrPath(loggerFactory, plugins).ToArray())
.Build();

return serviceProvider;
Expand Down
2 changes: 1 addition & 1 deletion src/OmniSharp.LanguageServerProtocol/LanguageServerHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void CreateCompositionHost(InitializeParams initializeParams)
var compositionHostBuilder = new CompositionHostBuilder(_serviceProvider)
.WithOmniSharpAssemblies()
.WithAssemblies(typeof(LanguageServerHost).Assembly)
.WithAssemblies(assemblyLoader.LoadByAssemblyNameOrPath(_logger, plugins.AssemblyNames).ToArray());
.WithAssemblies(assemblyLoader.LoadByAssemblyNameOrPath(_loggerFactory, plugins.AssemblyNames).ToArray());

_compositionHost = compositionHostBuilder.Build();

Expand Down
3 changes: 1 addition & 2 deletions src/OmniSharp.Stdio.Driver/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ static int Main(string[] args) => HostHelpers.Start(() =>
var options = serviceProvider.GetRequiredService<IOptionsMonitor<OmniSharpOptions>>();
var plugins = application.CreatePluginAssemblies(options.CurrentValue, environment);
var logger = loggerFactory.CreateLogger<Program>();
var compositionHostBuilder = new CompositionHostBuilder(serviceProvider)
.WithOmniSharpAssemblies()
.WithAssemblies(assemblyLoader.LoadByAssemblyNameOrPath(logger, plugins.AssemblyNames).ToArray());
.WithAssemblies(assemblyLoader.LoadByAssemblyNameOrPath(loggerFactory, plugins.AssemblyNames).ToArray());
using (var host = new Host(input, writer, environment, serviceProvider, compositionHostBuilder, loggerFactory, cancellation))
{
Expand Down

0 comments on commit 65899df

Please sign in to comment.