{"id":18758734,"url":"https://github.com/optical/serilogexceptionallogcontext","last_synced_at":"2025-04-13T02:23:54.573Z","repository":{"id":144128137,"uuid":"285237752","full_name":"optical/SerilogExceptionalLogContext","owner":"optical","description":"A Serilog enricher which captures exception log context as soon as the exception is raised, preventing loss of context.","archived":false,"fork":false,"pushed_at":"2022-11-29T09:53:08.000Z","size":19,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-04-10T21:47:49.422Z","etag":null,"topics":["serilog","serilog-enricher","serilog-enrichers"],"latest_commit_sha":null,"homepage":"","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/optical.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-05T09:10:54.000Z","updated_at":"2024-04-14T14:18:22.000Z","dependencies_parsed_at":"2024-06-21T07:25:51.954Z","dependency_job_id":null,"html_url":"https://github.com/optical/SerilogExceptionalLogContext","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optical%2FSerilogExceptionalLogContext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optical%2FSerilogExceptionalLogContext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optical%2FSerilogExceptionalLogContext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optical%2FSerilogExceptionalLogContext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/optical","download_url":"https://codeload.github.com/optical/SerilogExceptionalLogContext/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248655030,"owners_count":21140416,"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":["serilog","serilog-enricher","serilog-enrichers"],"created_at":"2024-11-07T17:47:32.653Z","updated_at":"2025-04-13T02:23:54.535Z","avatar_url":"https://github.com/optical.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serilog.ExceptionalLogContext\n[![Nuget](https://img.shields.io/nuget/v/Serilog.ExceptionalLogContext.svg)](https://nuget.org/packages/Serilog.ExceptionalLogContext) ![Compile](https://github.com/optical/SerilogExceptionalLogContext/workflows/.NET%20Core%20Compile/badge.svg)\n\nAn enricher for Serilog which will enhance your exceptions logged with their LogContext at the time they were thrown. If you use LogContext to enrich your logs with additional ambient details, but are frustrated that your low level exception logs lack this context, this enricher is for you.\n\nThis solves the issue described in [serilog/#984](https://github.com/serilog/serilog/issues/895). There is no need to use an exception filter and it also works for async/await too, all without changing any of your existing exception handling code\n\nThe problem described in code:\n```\ntry {\n\tLogContext.Push(\"InstanceId\", Guid.NewGuid()) {\n\t\tawait RunMyapplication();\n\t}\n} catch (Exception exception) {\n\t// Without Serilog.ExceptionalLogContext this log line won't have any of our LogContext properties as the stack has been unwound already, disposing of them :(\n\tLog.Error(exception, \"Oh no, something bad happened\");\n}\n```\n\nWith Serilog.ExceptionalLogContext your log LogContext state is cloned immediately when an exception is thrown, so that when your application eventually gets around to logging it, you'll still get to keep all that key information.\n\n## Usage\nIt's as simple as adding `.Enrich.WithExceptionalLogContext()` and you're done!\n\n```\nvar logger = new LoggerConfiguration()\n\t.Enrich.FromLogContext()\n\t.Enrich.WithExceptionalLogContext()\n\t// Write to a sink, add more enrichers, etc\n\t.CreateLogger();\n```\n\n## Acquistion\nDownload from [Nuget](https://nuget.org/packages/Serilog.ExceptionalLogContext)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptical%2Fserilogexceptionallogcontext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foptical%2Fserilogexceptionallogcontext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptical%2Fserilogexceptionallogcontext/lists"}