{"id":37054180,"url":"https://github.com/riccardotzr/dotlog","last_synced_at":"2026-01-14T06:06:58.180Z","repository":{"id":54785838,"uuid":"327127064","full_name":"riccardotzr/dotlog","owner":"riccardotzr","description":".NET 6 Request and Response Logging library","archived":false,"fork":false,"pushed_at":"2021-12-06T13:42:39.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-03T00:48:33.938Z","etag":null,"topics":["dotnetcore","logging","microservice","nuget","serilog"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/riccardotzr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-05T21:44:42.000Z","updated_at":"2021-12-06T13:42:42.000Z","dependencies_parsed_at":"2022-08-14T02:51:42.051Z","dependency_job_id":null,"html_url":"https://github.com/riccardotzr/dotlog","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/riccardotzr/dotlog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riccardotzr%2Fdotlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riccardotzr%2Fdotlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riccardotzr%2Fdotlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riccardotzr%2Fdotlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riccardotzr","download_url":"https://codeload.github.com/riccardotzr/dotlog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riccardotzr%2Fdotlog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28412188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["dotnetcore","logging","microservice","nuget","serilog"],"created_at":"2026-01-14T06:06:57.440Z","updated_at":"2026-01-14T06:06:58.174Z","avatar_url":"https://github.com/riccardotzr.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# DotLog\n\n[![Build Status](https://github.com/riccardotzr/dotlog/workflows/publish/badge.svg)](https://github.com/riccardotzr/ghealth/actions)\n[![NuGet Version](https://img.shields.io/nuget/v/DotLogNet.svg)](https://www.nuget.org/packages/DotLogNet/)\n[![Coverage Status](https://coveralls.io/repos/github/riccardotzr/dotlog/badge.svg?branch=main)](https://coveralls.io/github/riccardotzr/dotlog?branch=main)\n\n\u003c/div\u003e\n\nA .NET 6 Request and Response logging library. It uses [Serilog](https://github.com/serilog/serilog) library and implements a middleware to be used with .NET Core.\n\n## Install\nDotLog is installed from NuGet.\n\n```\nInstall-Package DotLogNet\n```\n\n## Usage\n\nThe simplest way to set up DotLog is configure the extension method in your application's _Program.cs_.\n\n```csharp\nusing DotLog;\n\npublic class Program \n{\n    public stati void Main(string[] args) \n    {\n        CreateHostBuilder(args).Build().Run();\n    }\n\n    public static IHostBuilder CreateHostBuilder(string[] args) =\u003e\n        Host.CreateDefaultBuilder(args)\n            .ConfigureWebHostDefaults(webBuilder =\u003e\n            {\n                webBuilder.UseStartup\u003cStartup\u003e();\n            });\n            .UseDotLog();\n}\n\n```\nBy default the log level is set to \"Information\" and the only sink configured is the Console sink. This is because the library is designed to be used in cloud environments, like Kubernetes, in combination with [FluentBit](https://fluentbit.io/) and [Fluentd](https://www.fluentd.org/).\n\n**Then**, the next step is to configure the logging middleware in your application's _Startup.cs_\n\n```csharp\npublic void Configure(IApplicationBuilder app, IWebHostEnvironment env) {\n    \n    app.UseLoggingMiddleware();\n} \n```\n\nThere is also an override of the _UseLogging Middleware()_ method that allows you not to log the request and response of certain routes.To do this it is necessary to specify the routes to be excluded as middleware options.\n\n```csharp\npublic void Configure(IApplicationBuilder app, IWebHostEnvironment env) {\n    \n    var routesToBeExcluded = new List\u003cstring\u003e() { \"/health\" };\n\n    app.UseLoggingMiddleware(new LoggerMiddleware() { RoutesToBeExcluded = routesToBeExcluded });\n}\n```\n\n## Output format\n\nEach request and response log will have the following JSON format:\n\n```json\n{\n    \"Level\": \"Information\",\n    \"Time\": \"1611932812\",\n    \"CorrelationId\": \"29494797-d298-4d33-8229-35a6c28b8948\",\n    \"Message\": \"My log message\",\n    \"Exception\": null,\n    \"Http\": {\n        \"Request\": {\n            \"Path\": \"/api/v1/customers/1\",\n            \"Method\": \"GET\",\n            \"Query\": null,\n            \"Body\": null,\n            \"ContentType\": \"application/json; charset=utf-8\",\n            \"Scheme\": \"http\",\n            \"Protocol\": \"HTTP/1.1\",\n            \"UserAgent\": \"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36\"\n        },\n        \"Response\": {\n            \"StatusCode\": 200,\n            \"ResponseTime\": 0.017,\n            \"Bytes\": null\n        }\n    },\n    \"Host\": {\n        \"Hostname\": \"localhost\",\n        \"ForwardedHostname\": \"id42.example-cdn.com\",\n        \"Ip\": \"127.0.0.1\"\n    }\n}\n```\n\n**In addition**, the middleware is responsible for recovering the CorrelationId from the HTTP Request Header to use it for each log entry, as follows:\n\n```json\n{\n    \"Level\": \"Information\",\n    \"Time\": \"1611932812\",\n    \"CorrelationId\": \"29494797-d298-4d33-8229-35a6c28b8948\",\n    \"Message\": \"My other log message\",\n    \"Exception\": null\n}\n```\n\n## Versioning\n\nThis project use [SemVer](https://semver.org/) for versioning. For availabe version, see the [tags](https://github.com/riccardotzr/dotlog/tags) on this repository.\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE.md](LICENSE.md)\nfile for details","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friccardotzr%2Fdotlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friccardotzr%2Fdotlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friccardotzr%2Fdotlog/lists"}