RestSharp.Serilog.Auto.Extented
2.0.2.1009
dotnet add package RestSharp.Serilog.Auto.Extented --version 2.0.2.1009
NuGet\Install-Package RestSharp.Serilog.Auto.Extented -Version 2.0.2.1009
<PackageReference Include="RestSharp.Serilog.Auto.Extented" Version="2.0.2.1009" />
paket add RestSharp.Serilog.Auto.Extented --version 2.0.2.1009
#r "nuget: RestSharp.Serilog.Auto.Extented, 2.0.2.1009"
// Install RestSharp.Serilog.Auto.Extented as a Cake Addin #addin nuget:?package=RestSharp.Serilog.Auto.Extented&version=2.0.2.1009 // Install RestSharp.Serilog.Auto.Extented as a Cake Tool #tool nuget:?package=RestSharp.Serilog.Auto.Extented&version=2.0.2.1009
RestSharp.Serilog.Auto.Extented
Do you need log all communication made with RestSharp using your serilog configuration? Just install this package and register our client proxy for IRestClient
.
IRestClient client = new RestClientAutolog("http://www.github.com");
Install via NuGet
PM> Install-Package RestSharp.Serilog.Auto.Extented
How to use
You can change error message, success message and logger configuration.
var loggerConfiguration = new LoggerConfiguration()
.MinimumLevel.Debug()
.Enrich.WithMachineName()
.Enrich.WithProperty("Domain", "MyDomain")
.Enrich.WithProperty("Application", "MyProject")
.WriteTo.Seq("http://localhost:5341")
.WriteTo.Console();
var restClientAutologConfiguration = new RestClientAutologConfiguration()
{
MessageTemplateForSuccess = "{Method} {Uri} responded {StatusCode}",
MessageTemplateForError = "{Method} {Uri} is not good! {ErrorMessage}",
LoggerConfiguration = loggerConfiguration
};
IRestClient client = new RestClientAutolog("http://www.github.com", restClientAutologConfiguration);
Serilog uses Log.Logger
as global. If you setup this on your application Startup/Bootstrap, it's not needed change logger configuration.
Variables to use in message templates
Properties created like (...).Enrich.WithProperty("Application", "MyProject")
can be used in templates.
Default variables:
Agent
ElapsedMilliseconds
Method
Uri
Host
Path
Query
Body
RequestHeaders
StatusCode
StatusDescription
ResponseStatus
ProtocolVersion
IsSuccessful
ErrorMessage
ErrorException
Content
ContentEncoding
ContentLength
ContentType
ResponseHeaders
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
- JsonMasking (>= 1.1.44)
- PackUtils (>= 1.0.50)
- RestSharp (>= 106.6.10)
- Serilog (>= 2.9.0)
- Serilog.Extensions.Logging (>= 3.0.1)
- Serilog.Settings.Configuration (>= 3.1.0)
- Serilog.Sinks.Console (>= 3.1.1)
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.0.2.1009 | 2,492 | 11/6/2019 |
2.0.2.1008 | 514 | 11/6/2019 |
1.1.13 | 563 | 8/15/2019 |
1.1.12 | 516 | 8/15/2019 |
1.1.0 | 530 | 8/15/2019 |
Forked from
https://github.com/ThiagoBarradas/restsharp-serilog-auto
Extended with ExecuteTaskAsync