Skip to content

Instantly share code, notes, and snippets.

@christiannagel
Created Nov 11, 2018
Embed
What would you like to do?
Configure TraceSource with .NET Core logging
static void RegisterServices(IConfiguration configuration)
{
ConfigureTraceSourceLogging();
var services = new ServiceCollection();
services.AddLogging(builder =>
{
builder.AddConfiguration(configuration.GetSection("Logging"))
.AddTraceSource(new SourceSwitch("TraceSourceLog", SourceLevels.Verbose.ToString()), s_listener)
.AddConsole();
#if DEBUG
builder.AddDebug();
#endif
});
services.AddHttpClient<SampleController>();
AppServices = services.BuildServiceProvider();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment