Skyworx.Logging
1.0.1
dotnet add package Skyworx.Logging --version 1.0.1
NuGet\Install-Package Skyworx.Logging -Version 1.0.1
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="Skyworx.Logging" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Skyworx.Logging" Version="1.0.1" />
<PackageReference Include="Skyworx.Logging" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Skyworx.Logging --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Skyworx.Logging, 1.0.1"
#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.
#:package Skyworx.Logging@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Skyworx.Logging&version=1.0.1
#tool nuget:?package=Skyworx.Logging&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Skyworx.Logging — Usage Guide
Installation
dotnet add package Skyworx.Logging
Program.cs
using Skyworx.Logging.Extensions;
var builder = WebApplication.CreateBuilder(args);
builder.AddSkyworxLogging("nama-service");
builder.Services.AddSkyworxAuditTrail(); // opsional
var app = builder.Build();
app.UseSkyworxLogging();
Logging
public class PaymentController : ControllerBase
{
private readonly ILogger<PaymentController> _logger;
public PaymentController(ILogger<PaymentController> logger) => _logger = logger;
public async Task<IActionResult> Create(CreateRequest request)
{
_logger.LogInformation("Creating payment {LoanAccountId}", request.LoanAccountId);
_logger.LogError(ex, "Failed to create payment {LoanAccountId}", request.LoanAccountId);
}
}
Output:
[10:31:45 INF] [a3f9b2c1] user-123 | Creating payment 9001
[10:31:46 ERR] [a3f9b2c1] user-123 | Failed to create payment 9001
Audit Trail
// appsettings.json
{
"ConnectionStrings": {
"LogConnection": "Host=...;Database=sky.log;Username=...;Password=..."
}
}
await _auditTrailService.LogAuditTrailAsync(
module: "loan.trx_payment",
actionType: "CREATE",
beforeData: null,
afterData: result,
remarks: "Payment created"
);
ApiResponse
return Ok(ApiResponse.Success(data, "Payment created"));
return NotFound(ApiResponse.Failure("Not found", ApiStatusCode.NotFound));
return BadRequest(ApiResponse.ValidationError("Validation failed", errors));
Docker
RUN mkdir -p /app/logs && chmod -R 777 /app/logs
docker run -d -v /host/logs:/app/logs --name my-service my-service:latest
| 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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- FluentValidation (>= 11.9.0)
- Npgsql (>= 8.0.0)
- Serilog.AspNetCore (>= 8.0.0)
- Serilog.Enrichers.Environment (>= 2.3.0)
- Serilog.Sinks.Console (>= 5.0.1)
- Serilog.Sinks.File (>= 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.