Created
October 4, 2019 14:34
-
-
Save alistairjevans/ebfea70fe9a94a196292ce87f3e57972 to your computer and use it in GitHub Desktop.
Startup with Nlog ILogger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Startup | |
{ | |
public Startup(IConfiguration configuration) | |
{ | |
// Get the factory for ILogger instances. | |
var nlogLoggerProvider = new NLogLoggerProvider(); | |
// Create an ILogger. | |
Logger = nlogLoggerProvider.CreateLogger(typeof(Startup).FullName); | |
} | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
Logger.LogInformation("Registering Services"); | |
// And the rest | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment