diff --git a/src/CP.Extensions.Hosting.PluginService/ServiceHost.cs b/src/CP.Extensions.Hosting.PluginService/ServiceHost.cs index 40221a2..0fc482c 100644 --- a/src/CP.Extensions.Hosting.PluginService/ServiceHost.cs +++ b/src/CP.Extensions.Hosting.PluginService/ServiceHost.cs @@ -37,7 +37,7 @@ public static class ServiceHost /// The host builder. /// The configure host. /// The plugin name space. - /// The target runtime. + /// The target runtime folder for plugins. /// /// A Task. /// @@ -71,23 +71,23 @@ public static Task Create( .ConfigureConfiguration(args) .ConfigurePlugins(pluginBuilder => { - var process = Process.GetCurrentProcess(); - var fullPath = process.MainModule?.FileName?.Replace(process.MainModule.ModuleName!, string.Empty); - - _logger?.Logger?.LogInformation("Running using dotNet {Version}", Environment.Version); - - var runtime = targetRuntime ?? Path.GetFileName(executableLocation); + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine("Running using dotNet {0}", Environment.Version); //// Specify the location from where the Dll's are "globbed" - _logger?.Logger?.LogInformation("Add Scan Directories: {FullPath}", fullPath); + var process = Process.GetCurrentProcess(); + var fullPath = process.MainModule?.FileName?.Replace(process.MainModule.ModuleName!, string.Empty); + Console.WriteLine("Add Scan Directories: {0}", fullPath); pluginBuilder?.AddScanDirectories(fullPath!); //// Add the framework libraries which can be found with the specified globs pluginBuilder?.IncludeFrameworks(@"\netstandard2.0\*.FrameworkLib.dll"); //// Add the plugins which can be found with the specified globs - _logger?.Logger?.LogInformation(@"Include Plugins from: \Plugins\{Runtime}\{NameSpace}*.dll", runtime, nameSpace); + var runtime = targetRuntime ?? Path.GetFileName(executableLocation); + Console.WriteLine(@"Include Plugins from: \Plugins\{0}\{1}*.dll", runtime, nameSpace); pluginBuilder?.IncludePlugins(@$"\Plugins\{runtime}\{nameSpace}*.dll"); + Console.ResetColor(); })! .ConfigureServices(serviceCollection => //// Make DefaultLogger available for logging @@ -109,8 +109,22 @@ public static Task Create( return host.RunAsync(new CancellationToken(false)); } - private static IHostBuilder? ConfigureExternal(this IHostBuilder? hostBuilder, Func? hostBuilderFunc) => - hostBuilderFunc == null ? hostBuilder : hostBuilderFunc.Invoke(hostBuilder); + private static IHostBuilder? ConfigureExternal(this IHostBuilder? hostBuilder, Func? hostBuilderFunc) + { + if (hostBuilderFunc == null) + { + return hostBuilder; + } + + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine("Configure External Start"); + Console.ResetColor(); + var builder = hostBuilderFunc(hostBuilder); + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine("Configure External Complete"); + Console.ResetColor(); + return builder; + } private static IHostBuilder? ConfigureLogging(this IHostBuilder? hostBuilder) => hostBuilder?.ConfigureLogging((hostContext, configLogging) => @@ -125,13 +139,19 @@ public static Task Create( hostBuilder? .ConfigureHostConfiguration(configHost => { + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine("Configure Host Start"); configHost.SetBasePath(Directory.GetCurrentDirectory()); configHost.AddJsonFile(HostSettingsFile, optional: true); configHost.AddEnvironmentVariables(prefix: Prefix); configHost.AddCommandLine(args); + Console.WriteLine("Configure Host Complete"); + Console.ResetColor(); }) .ConfigureAppConfiguration((hostContext, configApp) => { + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine("Configure App Start"); configApp.AddJsonFile(AppSettingsFilePrefix + ".json", optional: true); if (!string.IsNullOrEmpty(hostContext.HostingEnvironment.EnvironmentName)) { @@ -140,5 +160,7 @@ public static Task Create( configApp.AddEnvironmentVariables(prefix: Prefix); configApp.AddCommandLine(args); + Console.WriteLine("Configure App Complete"); + Console.ResetColor(); }); }