Simple library to Log event/errors into memory to be used in ASP.NET Core 2.x Projects
By using this library you will have the following features in your project:
- No need any database config
- Automatically logging all of the errors and events for each request based on LogLevel.
- Url to see logs, with search and filtering capabilities.
- ...
To install InMemoryLogger.Core, run the following command in the Package Manager Console.
pm> Install-Package InMemoryLogger.Core
You can also view the package page on NuGet.
1- install package from nuget.
2- add required services to Startup class as below :
services.AddInMemoryLogger(options=>
{
options.Filter = (loggerName, loglevel) => loglevel >= LogLevel.Error;
options.Path = "/InMemoryLogs";
});
3- add middleware to Startup class as below :
app.UseInMemoryLogger();
4- To view list of logs, enter the url defined at step 2 in browser. like : www.site.com/InMemoryLogs