https://github.com/dailydevops/logging.measurement
Extensions for `ILogger` implementations to measure execution times for a named scope.
https://github.com/dailydevops/logging.measurement
dotnet logger
Last synced: about 1 month ago
JSON representation
Extensions for `ILogger` implementations to measure execution times for a named scope.
- Host: GitHub
- URL: https://github.com/dailydevops/logging.measurement
- Owner: dailydevops
- License: mit
- Created: 2024-05-11T07:18:58.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-02-25T15:03:55.000Z (about 1 month ago)
- Last Synced: 2026-02-25T19:20:09.564Z (about 1 month ago)
- Topics: dotnet, logger
- Language: C#
- Homepage:
- Size: 592 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Agents: AGENTS.md
Awesome Lists containing this project
README
# NetEvolve.Logging.Measurement
[](https://www.nuget.org/packages/NetEvolve.Logging.Measurement/)
[](https://www.nuget.org/packages/NetEvolve.Logging.Measurement/)
[](LICENSE)
A lightweight extension library for [Microsoft.Extensions.Logging](https://learn.microsoft.com/aspnet/core/fundamentals/logging/) that enables simple and efficient time measurement of code blocks with automatic logging.
## Features
- ⏱️ **Simple Time Measurement** - Measure execution time of code blocks using intuitive `using` statements
- 📊 **Configurable Log Levels** - Control log output granularity with customizable completion levels
- 🔍 **Debug Information** - Optional caller information (member name, file path, line number) for detailed diagnostics
- 🎯 **Zero Overhead** - Minimal performance impact with efficient measurement implementation
- 🔧 **Flexible Integration** - Seamlessly integrates with existing `ILogger` implementations
## Installation
```bash
dotnet add package NetEvolve.Logging.Measurement
```
## Quick Start
```csharp
using Microsoft.Extensions.Logging;
using NetEvolve.Logging.Measurement;
public sealed class Example
{
private readonly ILogger _logger;
public Example(ILogger logger)
{
_logger = logger;
}
public void ProcessData()
{
using (_logger.StartMeasurement("Data Processing"))
{
// Your code here
// Execution time will be logged automatically when the scope is disposed
}
}
}
```
## Documentation
For detailed usage examples and advanced scenarios, see the [package documentation](src/NetEvolve.Logging.Measurement/README.md).
## Requirements
- .NET 8.0 or later
- Microsoft.Extensions.Logging.Abstractions 10.0.0 or compatible version
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.