Custom.Sinks.AmazonSQS
1.0.6
dotnet add package Custom.Sinks.AmazonSQS --version 1.0.6
NuGet\Install-Package Custom.Sinks.AmazonSQS -Version 1.0.6
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="Custom.Sinks.AmazonSQS" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Custom.Sinks.AmazonSQS --version 1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Custom.Sinks.AmazonSQS, 1.0.6"
#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 Custom.Sinks.AmazonSQS as a Cake Addin
#addin nuget:?package=Custom.Sinks.AmazonSQS&version=1.0.6
// Install Custom.Sinks.AmazonSQS as a Cake Tool
#tool nuget:?package=Custom.Sinks.AmazonSQS&version=1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Serilog.Sinks.AmazonSQS
Serilog.Sinks.AmazonSQS is a library to send logging information from Serilog to Amazon SQS. This implementation was inspired by Serilog.Sinks.AmazonS3 and Serilog.Sinks.AzureQueueStoragev2 projects
Getting Started
Simple Example
Log.Logger = new LoggerConfiguration()
.WriteTo.AmazonSQS(
"YourAwsAccessKey",
"YourAwsSecretKey",
"YourAwsServiceUr}", //example: https://sqs.sa-east-1.amazonaws.com
"YourAwsQueueUser",
"YourAwsQueueName")
.CreateLogger();
Log.Information("Hello, world!");
Complex Example
JSON appsettings.json
configuration
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"AWS": {
"Profile": "default",
"Region": "sa-east-1",
"AccessKey": "KEY",
"SecretKey": "KEY",
"ServiceUrl": "URL",
"QueueUser": "USER",
"QueueName": "QUEUE"
}
}
C# ServiceCollectionExtension.cs
configuration
public static class ServiceCollectionExtension
{
public static IServiceCollection AddDefaultLogOptions(this IServiceCollection collection,
IConfiguration configuration)
{
Log.Logger = new LoggerConfiguration()
.WriteTo.AmazonSQS(
configuration["AWS:AccessKey"],
configuration["AWS:SecretKey"],
configuration["AWS:ServiceUrl"],
configuration["AWS:QueueUser"],
configuration["AWS:QueueName"])
.CreateLogger();
collection.AddLogging(logginBuilder => { logginBuilder.AddSerilog(); });
return collection;
}
}
C# Program.cs
configuration
/*
<ItemGroup>
<PackageReference Include="Serilog" Version="2.12.0"/>
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0"/>
</ItemGroup>
*/
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
#region Serilog
builder.Services.AddDefaultLogOptions(builder.Configuration);
builder.Host.UseSerilog(Log.Logger);
#endregion
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
C# HomeController.cs
configuration
[ApiController]
[Route("[controller]")]
public class HomeController: ControllerBase
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
[HttpGet("test")]
public IActionResult Get()
{
_logger.LogInformation("Hello, world!");
return Ok();
}
}
Product | Versions 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 is compatible. 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.
-
net6.0
- AWSSDK.SQS (>= 3.7.200.18)
- Newtonsoft.Json (>= 13.0.3)
- Serilog (>= 3.0.1)
-
net7.0
- AWSSDK.SQS (>= 3.7.200.18)
- Newtonsoft.Json (>= 13.0.3)
- Serilog (>= 3.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.