RSEasyExceptionHandler 1.2.0

dotnet add package RSEasyExceptionHandler --version 1.2.0                
NuGet\Install-Package RSEasyExceptionHandler -Version 1.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RSEasyExceptionHandler" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RSEasyExceptionHandler --version 1.2.0                
#r "nuget: RSEasyExceptionHandler, 1.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RSEasyExceptionHandler as a Cake Addin
#addin nuget:?package=RSEasyExceptionHandler&version=1.2.0

// Install RSEasyExceptionHandler as a Cake Tool
#tool nuget:?package=RSEasyExceptionHandler&version=1.2.0                

RS_EasyExceptionHandling helper library for ASP.Net Core 6

The RS EasyExceptionHandling helper library developed by Mr. Ravinder Singh (ਰਵਿੰਦਰ ਸਿੰਘ), it helps you to manage error handling in your ASP.Net Core Web API or Web Site. So no need to write code for error loging for your project. The library supports ASP.NET Core 6 for now.

Features

  • ASP.Net Core 6 error tracking in the SQLite database
  • Send an error notification to the team

Getting started

Prerequisites

Requirements Requires .NET 6.0.

Following Nuget packages

  • Microsoft.EntityFrameworkCore
  • Microsoft.EntityFrameworkCore.Sqlite

How to use

Run the following command to install the package using the .NET CLI:

dotnet add package RSEasyExceptionHandler 

Alternatively, from the Package Manager Console or Developer PowerShell, run the following command to install the latest version:

Install-Package RSEasyExceptionHandler 

Alternatively, use the NuGet Package Manager for Visual Studio or the NuGet window for JetBrains Rider, then search for Twilio.AspNet.Core and install the package.

  • Open Program.cs class and regester <i>AddRS_ErrorHandlingMiddleware</i> Dependency near builder.Services.AddSwaggerGen();

    builder.Services.AddRS_ErrorHandlingMiddleware();
    
  • Note: Devloper can set own database name and location in the project. 1st create a folder like "Databaes" at root folder and then set "Data Source=database\RSAppErrorsLog.db" like following

    builder.Services.AddRS_ErrorHandlingMiddleware("Data Source=database\\MyAppErrorsLog.db");
    
  • Next add following code lines in Program.cs near app.Run();

    RSDependencyInjection.SetupLogDataBase(app.Services.CreateScope());
    app.UseMiddleware<RS_ErrorHandlingMiddleware>();
    
    
  • Add SMTP Settings in appsettings.json

    "RSError_EmailSenderSMTP": {
    "Host": "smtp-host.sendinblue.com",
    "Port": 587,
    "EnableSSL": true,
    "Username": "login email address",
    "Password": "password",
    
    "TL_Emails": "", //Team Lead or Project Manager emails (CC)
    "Dev_Emails": "ravinder25886@gmail.com", //Development team emails(TO)
    "enable_error_notification": false // true= will send mail and false mean off mailing
    }
    

How to read error log

We have developed very user friendly library so that developers can read error log without any hard work.

  • For read create a API controller and past following code. Now, you can show error log in your front end.

          [Route("api/[controller]")]
          [ApiController]
          public class ErrorLogController : ControllerBase
          {
              private readonly IErrorLogService _errorLogService;
    
              public ErrorLogController(IErrorLogService errorLogService)
              {
                  _errorLogService = errorLogService;
              }
    
              [HttpGet(Name = "GetErrorLog")]
              public async   Task<IActionResult> Get([FromQuery] PaginationFilter filter)
              {
                  return Ok(await _errorLogService.GetListAsync(filter)); 
              }
          }
    

    Delete log functions

          [HttpPost]
          [Route("DeleteAll")]
          public async Task<IActionResult> DeleteAll(CancellationToken cancellationToken)
          {
              return Ok(await _errorLogCommandsService.DeleteAllAsync(cancellationToken));
          }
          [HttpDelete("{id}")]
          public async Task<IActionResult> DeleteAll(Guid id, CancellationToken cancellationToken)
          {
              return Ok(await _errorLogCommandsService.DeleteByIdAsync(id, cancellationToken));
          }
    

Feedback

If this package is help full to you, then please share this package with your developer's friends. Moroeover, if you want to share your comment then please use following chanels:-

Contact me

About me

I am a senior programmer with good knowledge of both front-end and back-end techniques(FULL STACK).

Read more

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 192 4/19/2023
1.0.0 165 4/19/2023

It is beta version