Log to elmah.io from Microsoft.Extensions.Logging.
Elmah.Io.Extensions.Logging installs through NuGet:
PS> Install-Package Elmah.Io.Extensions.Logging
Configure the elmah.io provider through code:
var factory = new LoggerFactory();
factory.AddElmahIo("API_KEY", new Guid("LOG_ID"));
var logger = factory.CreateLogger("MyLog");
In the example we create a new LoggerFactory
and add the elmah.io provider using the AddElmahIo
extension method, an API key and the Guid of the desired log. Finally, we create a new logger which is used later in this example to log messages to elmah.io.
Log messages to elmah.io, just as with every other provider:
logger.LogInformation("This is information");