RSoft.Logs
1.0.0-rc1.1
See the version list below for details.
dotnet add package RSoft.Logs --version 1.0.0-rc1.1
NuGet\Install-Package RSoft.Logs -Version 1.0.0-rc1.1
<PackageReference Include="RSoft.Logs" Version="1.0.0-rc1.1" />
paket add RSoft.Logs --version 1.0.0-rc1.1
#r "nuget: RSoft.Logs, 1.0.0-rc1.1"
// Install RSoft.Logs as a Cake Addin #addin nuget:?package=RSoft.Logs&version=1.0.0-rc1.1&prerelease // Install RSoft.Logs as a Cake Tool #tool nuget:?package=RSoft.Logs&version=1.0.0-rc1.1&prerelease
RSoft.Logs
Logging mechanism for elastic (direct mode) and terminal console
RSoft.Logs is a provider of logging mechanisms based on the standard .Net Core ILogger interface. The available resources are:
- Elastic logger provider
- Console logger provider
- Middlware API Request/Response logger
Release Notes
Version 1.0.0-rc1.1
- Fix field name 'TradeId' ⇒ 'TraceId' in GenericExceptionResponse.
WARNING:
RSoft.Logs uses release candidate version of the System.Text.Json package. This version is not yet stable and therefore the RSoft.Logs package will maintain the same condition until the final version of this version is released.
Installaction
- PackageManage:
Install-Package RSoft.Logs -Version 1.0.0-preview200904.1
- .NET Cli:
dotnet add package RSoft.Logs --version 1.0.0-preview200904.1
- Package Reference:
<PackageReference Include="RSoft.Logs" Version="1.0.0-preview200904.1" />
- Paket Cli:
paket add RSoft.Logs --version 1.0.0-preview200904.1
Configuration
The configuration of all the mechanisms of this package are done through the appsettings.json
of the application, in the section Logging as complete complete below
"Logging": {
"LogLevel": {
[--- LogLevel default microsoft configuration ---]
},
"Elastic": {
"Uri": "http://localhost:9200",
"DefaultIndexName": "my-index-name",
"IgnoreCategories": [
"Microsoft.Hosting.Lifetime"
]
},
"RequestResponseMiddleware": {
"LogRequest": true,
"LogResponse": true,
"SecurityActions": [
{
"Method": "POST",
"Path": "/api/auth"
}
]
}
}
Elastic
Section configuration
Uri
⇒ Elastic Service url runningDefaultIndxName
⇒ Name of the document index to save the logsIgnoreCategoris
⇒ List of categories to ignore in the log record.
RequestResponseMiddleware
Section configuration
LogRequest
⇒ Enables or disables request logging (disabled by default)LogReponse
⇒ Enables or disables response logging (disabled by default)SecurityActions
→ List of keys Method + Action that will have the request body hidden in the log recording. Use this section to indicate points where sensitive information, such as a password for example, is being trafficked.
Implementation in your application
In the program.cs
file, add the calls to the desired modules to the ConfigureLogging
section, according to the model below::
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using RSoft.Logs.Extensions;
namespace MyApplication.Web.Api
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddConsoleLogger();
logging.AddElasticLogger();
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
In the Startup.cs
file add the following codes: .
Import the namespaces:
using RSoft.Logs.Extensions;
using RSoft.Logs.Middleware;
In ConfigureServices
method add the line:
services.AddMiddlewareLoggingOption(Configuration);
In Configure
method add the line:
app.UseMiddleware<RequestResponseLogging<Startup>>();
That's all you need.
THANK'S
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.AspNetCore.Hosting (>= 2.2.7)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.Extensions.Http (>= 3.1.8)
- Microsoft.Extensions.Logging (>= 3.1.8)
- Microsoft.Extensions.Logging.Abstractions (>= 3.1.8)
- Microsoft.Extensions.Logging.Configuration (>= 3.1.8)
- System.Configuration.ConfigurationManager (>= 4.7.0)
- System.Text.Json (>= 5.0.0-rc.1.20451.14)
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.3.2 | 491 | 8/3/2022 |
1.3.1 | 416 | 10/10/2021 |
1.3.0 | 363 | 10/6/2021 |
1.2.2 | 382 | 9/8/2021 |
1.2.1 | 376 | 9/8/2021 |
1.2.0 | 366 | 9/8/2021 |
1.1.0 | 349 | 8/26/2021 |
1.1.0-rc1.7 | 163 | 8/6/2021 |
1.1.0-rc1.6 | 198 | 5/31/2021 |
1.1.0-rc1.5 | 166 | 5/30/2021 |
1.1.0-rc1.4 | 145 | 5/27/2021 |
1.1.0-rc1.3 | 168 | 4/22/2021 |
1.1.0-rc1.2 | 148 | 4/21/2021 |
1.1.0-rc1.1 | 156 | 4/20/2021 |
1.1.0-rc1.0 | 150 | 4/19/2021 |
1.0.0 | 461 | 11/18/2020 |
1.0.0-rc1.7 | 338 | 10/18/2020 |
1.0.0-rc1.6 | 208 | 10/15/2020 |
1.0.0-rc1.4 | 246 | 10/10/2020 |
1.0.0-rc1.3 | 328 | 9/26/2020 |
1.0.0-rc1.2 | 256 | 9/23/2020 |
1.0.0-rc1.1 | 269 | 9/22/2020 |
1.0.0-rc1.0 | 282 | 9/16/2020 |
1.0.0-preview200914.2 | 264 | 9/14/2020 |
1.0.0-preview200904.1 | 334 | 9/4/2020 |
1.0.0-preview200831.1 | 269 | 8/31/2020 |