RestSharp.Serilog.Auto.Extented 2.0.2.1009

Install-Package RestSharp.Serilog.Auto.Extented -Version 2.0.2.1009
dotnet add package RestSharp.Serilog.Auto.Extented --version 2.0.2.1009
<PackageReference Include="RestSharp.Serilog.Auto.Extented" Version="2.0.2.1009" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RestSharp.Serilog.Auto.Extented --version 2.0.2.1009
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RestSharp.Serilog.Auto.Extented, 2.0.2.1009"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// 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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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

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 310 11/6/2019
2.0.2.1008 234 11/6/2019
1.1.13 274 8/15/2019
1.1.12 243 8/15/2019
1.1.0 260 8/15/2019

Forked from
https://github.com/ThiagoBarradas/restsharp-serilog-auto
Extended with ExecuteTaskAsync