RaygunCore.AspNetCore
2.6.0
dotnet add package RaygunCore.AspNetCore --version 2.6.0
NuGet\Install-Package RaygunCore.AspNetCore -Version 2.6.0
<PackageReference Include="RaygunCore.AspNetCore" Version="2.6.0" />
<PackageVersion Include="RaygunCore.AspNetCore" Version="2.6.0" />
<PackageReference Include="RaygunCore.AspNetCore" />
paket add RaygunCore.AspNetCore --version 2.6.0
#r "nuget: RaygunCore.AspNetCore, 2.6.0"
#addin nuget:?package=RaygunCore.AspNetCore&version=2.6.0
#tool nuget:?package=RaygunCore.AspNetCore&version=2.6.0
Raygun provider for .NET
Standart Raygun4Net library does not work well with .NET. So I've created library for new architecture:
- Built with interfaces and works via default dependency injection;
- As result, services can be easily extended or replaced;
- You can work via
IRaygunClient
directly or useRaygunLogger
or intergrate handler into ASP.NET Core pipeline.
Installation via NuGet
Package | Description | NuGet |
---|---|---|
RaygunCore | Raygun client and logger | |
RaygunCore.AspNetCore | Handler for ASP.NET Core request pipeline |
How to use with ASP.NET Core
Register services in Startup
class:
public void ConfigureServices(IServiceCollection services)
{
// configure with API KEY
services.AddRaygun("_API_KEY_")
.WithHttp();
// or with options
services.AddRaygun(opt => opt.ApiKey = "_API_KEY_")
.WithHttp();
// or with configuration section
services.AddRaygun(configuration)
.WithHttp();
}
Method AddRaygun()
registers only minimal required services. So then you can request IRaygunClient
service and send errors:
public async Task<string> ActionInController([FromServices]IRaygunClient raygun)
{
try
{
// some code
}
catch (Exception ex)
{
await raygun.SendAsync(ex);
}
return "OK";
}
Method WithHttp()
in application services registration adds pipeline handler so any exception in request is automatically sent to Raygun.
How to use with logging
You can register Raygun logger provider:
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureLogging((context, logging) => logging
.AddRaygun(r => r
.Configure(opt => opt.ApiKey = "_API_KEY_")
.WithHttp()
)
);
Then just use logger:
public async Task<string> ActionInController([FromServices]ILogger<MyController> logger)
{
logger.LogError(0, "My error message");
}
License
This package has MIT license. Refer to the LICENSE for detailed information.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- RaygunCore (>= 2.6.0)
-
net9.0
- RaygunCore (>= 2.6.0)
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 |
---|---|---|
2.6.0 | 135 | 5/6/2025 |
2.5.0 | 499 | 11/13/2024 |
2.4.0 | 277 | 6/24/2024 |
2.3.0 | 905 | 3/20/2023 |
2.2.0 | 255 | 3/15/2023 |
2.1.0 | 407 | 12/22/2022 |
2.0.0 | 823 | 3/29/2022 |
1.6.0 | 2,863 | 1/11/2020 |
1.5.0 | 734 | 11/18/2019 |
1.4.0 | 2,360 | 12/5/2018 |
1.3.1 | 749 | 12/3/2018 |
1.3.0 | 898 | 11/7/2018 |
1.2.0 | 753 | 10/24/2018 |
1.1.0 | 1,993 | 6/27/2018 |
1.0.2 | 4,050 | 2/13/2018 |
1.0.1 | 1,118 | 2/12/2018 |