Install-Package RestSharp.Serilog.Auto.Extented -Version
dotnet add package RestSharp.Serilog.Auto.Extented --version
<PackageReference Include="RestSharp.Serilog.Auto.Extented" Version="" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RestSharp.Serilog.Auto.Extented --version
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RestSharp.Serilog.Auto.Extented,"
#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=

// Install RestSharp.Serilog.Auto.Extented as a Cake Tool
#tool nuget:?package=RestSharp.Serilog.Auto.Extented&version=
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


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("");

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()
                .Enrich.WithProperty("Domain", "MyDomain")
                .Enrich.WithProperty("Application", "MyProject")

var restClientAutologConfiguration = new RestClientAutologConfiguration()
    MessageTemplateForSuccess = "{Method} {Uri} responded {StatusCode}", 
    MessageTemplateForError = "{Method} {Uri} is not good! {ErrorMessage}", 
    LoggerConfiguration = loggerConfiguration

IRestClient client = new RestClientAutolog("", 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 310 11/6/2019 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
Extended with ExecuteTaskAsync