{"id":21885691,"url":"https://github.com/jakenveina/structuredloggermessage","last_synced_at":"2025-10-08T20:33:06.703Z","repository":{"id":121270056,"uuid":"379098536","full_name":"JakenVeina/StructuredLoggerMessage","owner":"JakenVeina","description":"A library for high-performance structural logging.","archived":false,"fork":false,"pushed_at":"2021-09-16T00:55:08.000Z","size":33,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-30T00:06:47.455Z","etag":null,"topics":["dotnet","logging"],"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/JakenVeina.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":"2021-06-22T00:35:59.000Z","updated_at":"2023-03-13T09:18:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"56042782-23c6-4963-ba03-1e0934f1d13d","html_url":"https://github.com/JakenVeina/StructuredLoggerMessage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakenVeina%2FStructuredLoggerMessage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakenVeina%2FStructuredLoggerMessage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakenVeina%2FStructuredLoggerMessage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakenVeina%2FStructuredLoggerMessage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JakenVeina","download_url":"https://codeload.github.com/JakenVeina/StructuredLoggerMessage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235756948,"owners_count":19040477,"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":["dotnet","logging"],"created_at":"2024-11-28T10:28:52.848Z","updated_at":"2025-10-08T20:33:01.347Z","avatar_url":"https://github.com/JakenVeina.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# StructuredLoggerMessage\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![Continuous Deployment](https://github.com/JakenVeina/StructuredLoggerMessage/workflows/Continuous%20Deployment/badge.svg)](https://github.com/JakenVeina/StructuredLoggerMessage/actions?query=workflow%3A%22Continuous+Deployment%22)\n[![NuGet](https://img.shields.io/nuget/v/StructuredLoggerMessage.svg)](https://www.nuget.org/packages/StructuredLoggerMessage/)\n\nA library for high-performance structural logging, utilizing the [.NET Extensions Logging Framework](https://docs.microsoft.com/en-us/dotnet/core/extensions/logging?tabs=command-line), and modeled after the [.NET API for high-performance logging](https://docs.microsoft.com/en-us/dotnet/core/extensions/high-performance-logging). The primary difference between the .NET `LoggerMessage` API, and the `StructuralLoggerMessage` API is that it allows for consumers to log data values for use by structural loggers, without requiring that those values be part of the format string used by text loggers.\n\n## Usage\n\nThe `StructuralLoggerMessage` API allows consumers to define specific log messages ahead-of-time, in the form of `Action` delegates that are type-safe and include cached calculation results for optimizing text generation of log messages.\n\n```cs\npublic static readonly Action\u003cILogger, string, int, string?\u003e DataValueChanged\n    = StructuredLoggerMessage.Define\u003cstring, int, string?\u003e(\n        LogLevel.Debug,\n        new EventId(1001, nameof(DataValueChanged)),\n        \"{DataValueName} Changed\",\n        \"DataValue\",\n        \"ChangedBy\");\n```\n\nThis allows a consumer to invoke...\n\n```cs\nDataValueChanged.Invoke(logger, \"MyValue\", 7, \"me\");\n```\n\n...to produce the text log message...\n\n```\nMyValue Changed\n```\n\n...and a structural log state consisting of...\n\n```cs\n{\n    [\"DataValueName\"] =\u003e \"MyValue\",\n    [\"DataValue\"] =\u003e 7,\n    [\"ChangedBy\"] =\u003e \"me\"\n    [\"{OriginalFormat}\"] =\u003e \"{DataValueName} Changed\"\n}\n```\n\nThis is equivalent to a call to the corresponding Microsoft API...\n\n```cs\npublic static readonly Action\u003cILogger, string, int, string?\u003e DataValueChanged\n    = LoggerMessage.Define\u003cstring, int, string?\u003e(\n        LogLevel.Debug,\n        new EventId(1001, nameof(DataValueChanged)),\n        \"{DataValueName} Changed: {DataValue} {ChangedBy}\");\n```\n\n...except, as you can see, not all logged values must be embedded in the format string of the log message.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakenveina%2Fstructuredloggermessage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakenveina%2Fstructuredloggermessage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakenveina%2Fstructuredloggermessage/lists"}