{"id":21706689,"url":"https://github.com/ogulcanturan/ogu.extensions.logging.timings","last_synced_at":"2025-10-10T01:43:22.394Z","repository":{"id":182400396,"uuid":"668445861","full_name":"ogulcanturan/Ogu.Extensions.Logging.Timings","owner":"ogulcanturan","description":"This library is an adaptation of Serilog Timings for Microsoft ILogger interface","archived":false,"fork":false,"pushed_at":"2025-03-20T19:11:17.000Z","size":49,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T20:56:37.161Z","etag":null,"topics":["extensions","ilogger","logging","serilog","timings"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/Ogu.Extensions.Logging.Timings","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/ogulcanturan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null}},"created_at":"2023-07-19T20:34:52.000Z","updated_at":"2025-03-20T19:06:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a3955ec-77b3-451c-ba1c-03a5611641b1","html_url":"https://github.com/ogulcanturan/Ogu.Extensions.Logging.Timings","commit_stats":null,"previous_names":["ogulcanturan/ogu.extensions.logging.timings"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ogulcanturan/Ogu.Extensions.Logging.Timings","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogulcanturan%2FOgu.Extensions.Logging.Timings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogulcanturan%2FOgu.Extensions.Logging.Timings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogulcanturan%2FOgu.Extensions.Logging.Timings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogulcanturan%2FOgu.Extensions.Logging.Timings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ogulcanturan","download_url":"https://codeload.github.com/ogulcanturan/Ogu.Extensions.Logging.Timings/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogulcanturan%2FOgu.Extensions.Logging.Timings/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002399,"owners_count":26083374,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["extensions","ilogger","logging","serilog","timings"],"created_at":"2024-11-25T22:14:07.602Z","updated_at":"2025-10-10T01:43:22.377Z","avatar_url":"https://github.com/ogulcanturan.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cimg src=\"logo/ogu-logo.png\" alt=\"Header\" width=\"24\"/\u003e Ogu.Extensions.Logging.Timings\n\n[![.NET Core Desktop](https://github.com/ogulcanturan/Ogu.Extensions.Logging.Timings/actions/workflows/dotnet.yml/badge.svg?branch=master)](https://github.com/ogulcanturan/Ogu.Extensions.Logging.Timings/actions/workflows/dotnet-desktop.yml)\n[![NuGet](https://img.shields.io/nuget/v/Ogu.Extensions.Logging.Timings.svg?color=1ecf18)](https://nuget.org/packages/Ogu.Extensions.Logging.Timings)\n[![Nuget](https://img.shields.io/nuget/dt/Ogu.Extensions.Logging.Timings.svg?logo=nuget)](https://nuget.org/packages/Ogu.Extensions.Logging.Timings)\n\n## Introduction\n\nThis library brings the feature-rich capabilities of [SerilogTimings](https://github.com/nblumhardt/serilog-timings/) to `Microsoft.Extensions.Logging`. Designed to seamlessly integrate with `Microsoft.Extensions.Logging`, this library enables developers to incorporate structured timing measurements into their log entries, enhancing the logging experience and providing valuable performance insights. If you are already familiar with [SerilogTimings](https://github.com/nblumhardt/serilog-timings/), you'll find it easy to use this library as it maintains the same ease of use and flexibility while targeting Microsoft.Extensions.Logging.\n\n## Features\n\n- **Structured Timing Logs:** Add precise timing information to your log entries using structured logs, enhancing your ability to analyze and diagnose application performance.\n- **Effortless Integration:** Seamlessly integrate the timing functionality into your existing Microsoft.Extensions.Logging workflow without any additional dependencies.\n- **Flexibility:** Enjoy the benefits of timings in your Microsoft.Extensions.Logging-based projects, keeping the freedom to choose your preferred logging providers.\n\n## Installation\n\nYou can install the library via NuGet Package Manager:\n\n```bash\ndotnet add package Ogu.Extensions.Logging.Timings\n```\n## Usage\n\n**example 1:**\n```csharp\nusing (logger.TimeOperation(\"User: {UserId} is saving to database\", userId))\n{\n    ...\n}\n```\n\noutput\n\n```bash\ninfo: Timings.Console.Program[0]\n      User: 1 is saving to database completed in 0.4712ms\n```\n\n**example 2:**\n```csharp\nusing (var op = logger.BeginOperation(\"User: {UserId} is removing from database.\", userId))\n{\n    if (true)\n    {\n        op.Abandon();\n    }\n\n    // Do some operations\n\n    op.Complete(\"Username\", \"ogulcanturan\");\n}\n```\n\noutput\n\n```bash\nwarn: Timings.Console.Program[0]\n      User: 1 is removing from database. abandoned in 0.0581ms\n```\n\n**example 3:**\n```csharp\nusing (var op = logger.BeginOperation(\"You will not see this message on console, because of this statement =\u003e 'op.Cancel()'\"))\n{\n    if (true)\n    {\n        op.Cancel();\n    }\n\n    // Do some operations\n\n    op.Complete();\n}\n```\n\noutput\n\n```bash\n\n```\n\n\n**example 4:**\n```csharp\nusing (var op = logger.BeginOperation(\"Doing some operations...\"))\n{\n    try\n    {\n        int calculation = int.Parse(\"You cannot parse this to number!\");\n    }\n    catch (Exception ex)\n    {\n        op.SetException(ex);\n    }\n\n    op.Complete(); // If you don't call 'op.Complete()' it will call implicitly 'op.Abandon()'\n}\n```\n\noutput\n\n```bash\ninfo: Timings.Console.Program[0]\n      Doing some operations... completed in 1434.2430ms\n      System.FormatException: The input string 'You cannot parse this to number!' was not in a correct format.\n         at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, ReadOnlySpan`1 value, TypeCode type)\n         at System.Int32.Parse(String s)\n         at Timings.Console.Program.Main(String[] args) in ...\n```\n\n\n**example 5:**\n```csharp\nusing (logger.OperationAt(LogLevel.Trace).Time(\"App is closing...\"))\n{\n    // Do some operations\n}\n```\n\noutput\n\n```bash\ntrce: Timings.Console.Program[0]\n      App is closing... completed in 0.0015ms\n```\n\n## Sample Application\nA sample application demonstrating the usage of Ogu.Extensions.Logging.Timings can be found [here](https://github.com/ogulcanturan/Ogu.Extensions.Logging.Timings/blob/master/samples/Timings.Console/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fogulcanturan%2Fogu.extensions.logging.timings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fogulcanturan%2Fogu.extensions.logging.timings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fogulcanturan%2Fogu.extensions.logging.timings/lists"}