{"id":20138473,"url":"https://github.com/thiagobarradas/restsharp-serilog-auto","last_synced_at":"2025-04-09T18:08:48.831Z","repository":{"id":33201070,"uuid":"141510763","full_name":"ThiagoBarradas/restsharp-serilog-auto","owner":"ThiagoBarradas","description":"Automatic log request and response from RestSharp using Serilog","archived":false,"fork":false,"pushed_at":"2024-07-12T20:45:41.000Z","size":104,"stargazers_count":22,"open_issues_count":1,"forks_count":13,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-23T20:05:38.910Z","etag":null,"topics":["auto","automatic","dotnet","dotnet-core","log","logger","logging","request","response","rest","restsharp","seq","serilog","serilog-enricher","serilog-extension","splunk"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/RestSharp.Serilog.Auto/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThiagoBarradas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-19T01:52:44.000Z","updated_at":"2025-02-02T22:02:03.000Z","dependencies_parsed_at":"2024-07-12T22:28:20.704Z","dependency_job_id":null,"html_url":"https://github.com/ThiagoBarradas/restsharp-serilog-auto","commit_stats":{"total_commits":56,"total_committers":6,"mean_commits":9.333333333333334,"dds":0.2857142857142857,"last_synced_commit":"632b7df120d02561f6b7aaad76db6292c7fec108"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThiagoBarradas%2Frestsharp-serilog-auto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThiagoBarradas%2Frestsharp-serilog-auto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThiagoBarradas%2Frestsharp-serilog-auto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThiagoBarradas%2Frestsharp-serilog-auto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThiagoBarradas","download_url":"https://codeload.github.com/ThiagoBarradas/restsharp-serilog-auto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085132,"owners_count":21045135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auto","automatic","dotnet","dotnet-core","log","logger","logging","request","response","rest","restsharp","seq","serilog","serilog-enricher","serilog-extension","splunk"],"created_at":"2024-11-13T21:38:15.967Z","updated_at":"2025-04-09T18:08:48.803Z","avatar_url":"https://github.com/ThiagoBarradas.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://barradas.visualstudio.com/Contributions/_apis/build/status/NugetPackage/RestSharp%20Serilog%20Auto?branchName=develop)](https://barradas.visualstudio.com/Contributions/_build/latest?definitionId=14\u0026branchName=master)\n[![NuGet Downloads](https://img.shields.io/nuget/dt/RestSharp.Serilog.Auto.svg)](https://www.nuget.org/packages/RestSharp.Serilog.Auto/)\n[![NuGet Version](https://img.shields.io/nuget/v/RestSharp.Serilog.Auto.svg)](https://www.nuget.org/packages/RestSharp.Serilog.Auto/)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ThiagoBarradas_restsharp-serilog-auto\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=ThiagoBarradas_restsharp-serilog-auto)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=ThiagoBarradas_restsharp-serilog-auto\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=ThiagoBarradas_restsharp-serilog-auto)\n\n# RestSharp.Serilog.Auto\n\nDo you need log all communication made with RestSharp using your serilog configuration? Just install this package and register our client proxy for `IRestClient`.\n\n```c#\nIRestClient client = new RestClientAutolog(\"http://www.github.com\");\n```\n\n## Install via NuGet\n\n```\nPM\u003e Install-Package RestSharp.Serilog.Auto\n```\n\n## How to use\n\nYou can change error message, success message and logger configuration. \n\n```c#\n\nvar loggerConfiguration = new LoggerConfiguration()\n                .MinimumLevel.Debug()\n                .Enrich.WithMachineName()\n                .Enrich.WithProperty(\"Domain\", \"MyDomain\")\n                .Enrich.WithProperty(\"Application\", \"MyProject\")\n                .Enrich.FromLogContext()\n                .WriteTo.Seq(\"http://localhost:5341\")\n                .WriteTo.Console();\n\nvar restClientAutologConfiguration = new RestClientAutologConfiguration()\n{\n    MessageTemplateForSuccess = \"{Method} {Url} responded {StatusCode}\", \n    MessageTemplateForError = \"{Method} {Url} is not good! {ErrorMessage}\", \n    LoggerConfiguration = loggerConfiguration\n};\n\nIRestClient client = new RestClientAutolog(\"http://www.github.com\", restClientAutologConfiguration);\n```\n\nSerilog uses `Log.Logger` as global. If you setup this on your application Startup/Bootstrap, it's not needed change logger configuration.\n\n## Variables to use in message templates\n\nProperties created like `(...).Enrich.WithProperty(\"Application\", \"MyProject\")` can be used in templates.\n\nDefault variables:\n\n* `Agent`\n* `ElapsedMilliseconds`\n* `Method`\n* `Url`\n* `Host`\n* `Path`\n* `Port`\n* `QueryString`\n* `Query`\n* `RequestBody`\n* `RequestHeaders`\n* `StatusCode`\n* `StatusCodeFamily`\n* `StatusDescription`\n* `ResponseStatus`\n* `IsSuccessful`\n* `ErrorMessage`\n* `ErrorException`\n* `ResponseContent`\n* `ContentLength`\n* `ContentType`\n* `ContentEncoding`\n* `ResponseHeaders`\n* `ProtocolVersion`\n\n## Setup global max length for exception properties\n\nUse env var to change default value\n\n- `SERILOG_ERROR_MESSAGE_MAX_LENGTH` default value 256;\n- `SERILOG_ERROR_EXCEPTION_MAX_LENGTH` default value 1024;\n\n## How can I contribute?\nPlease, refer to [CONTRIBUTING](.github/CONTRIBUTING.md)\n\n## Found something strange or need a new feature?\nOpen a new Issue following our issue template [ISSUE_TEMPLATE](.github/ISSUE_TEMPLATE.md)\n\n## Changelog\nSee in [nuget version history](https://www.nuget.org/packages/RestSharp.Serilog.Auto)\n\n## Did you like it? Please, make a donate :)\n\nif you liked this project, please make a contribution and help to keep this and other initiatives, send me some Satochis.\n\nBTC Wallet: `1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX`\n\n![1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX](https://i.imgur.com/mN7ueoE.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagobarradas%2Frestsharp-serilog-auto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthiagobarradas%2Frestsharp-serilog-auto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagobarradas%2Frestsharp-serilog-auto/lists"}