Skip to content

Commit

Permalink
improving WebHost dev console logging wire-up (#10633)
Browse files Browse the repository at this point in the history
  • Loading branch information
brettsam authored Nov 14, 2024
1 parent 6f7b2d5 commit cc01cfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/WebJobs.Script.WebHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ public static IWebHostBuilder CreateWebHostBuilder(string[] args = null)
loggingBuilder.Services.AddSingleton<DeferredLoggerProvider>();
loggingBuilder.Services.AddSingleton<ILoggerProvider>(s => s.GetRequiredService<DeferredLoggerProvider>());
loggingBuilder.AddConsoleIfEnabled(context.HostingEnvironment.IsDevelopment(), context.Configuration);
if (context.HostingEnvironment.IsDevelopment())
{
loggingBuilder.AddConsole();
}
})
.UseStartup<Startup>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void AddConsoleIfEnabled(this ILoggingBuilder builder, HostBuilder
builder.AddConsoleIfEnabled(context.HostingEnvironment.IsDevelopment(), context.Configuration);
}

public static void AddConsoleIfEnabled(this ILoggingBuilder builder, bool isDevelopment, IConfiguration configuration)
private static void AddConsoleIfEnabled(this ILoggingBuilder builder, bool isDevelopment, IConfiguration configuration)
{
// console logging defaults to false, except for self host
bool enableConsole = isDevelopment;
Expand Down

0 comments on commit cc01cfa

Please sign in to comment.