Serilog.Enrichers.Metrics.Memory
0.1.0-memory-enricher.8
See the version list below for details.
dotnet add package Serilog.Enrichers.Metrics.Memory --version 0.1.0-memory-enricher.8
NuGet\Install-Package Serilog.Enrichers.Metrics.Memory -Version 0.1.0-memory-enricher.8
<PackageReference Include="Serilog.Enrichers.Metrics.Memory" Version="0.1.0-memory-enricher.8" />
<PackageVersion Include="Serilog.Enrichers.Metrics.Memory" Version="0.1.0-memory-enricher.8" />
<PackageReference Include="Serilog.Enrichers.Metrics.Memory" />
paket add Serilog.Enrichers.Metrics.Memory --version 0.1.0-memory-enricher.8
#r "nuget: Serilog.Enrichers.Metrics.Memory, 0.1.0-memory-enricher.8"
#:package Serilog.Enrichers.Metrics.Memory@0.1.0-memory-enricher.8
#addin nuget:?package=Serilog.Enrichers.Metrics.Memory&version=0.1.0-memory-enricher.8&prerelease
#tool nuget:?package=Serilog.Enrichers.Metrics.Memory&version=0.1.0-memory-enricher.8&prerelease
Serilog.Enrichers.Metrics
Overview
This repository provides Serilog enrichers for monitoring IO operations and memory usage of the current process. These enrichers are extremely helpful when writing applications where low memory consumption is key. IO operation metrics allow you to track how much data is being read or written by your application.
- Serilog.Enrichers.Metrics.IO: Adds metrics for IO read/write operations (
IoReadBytes,IoWriteBytes). - Serilog.Enrichers.Metrics.Memory: Adds metrics for memory usage by the current process (
WorkingSetBytes,ManagedMemoryBytes).
Features
- Track memory usage in real time.
- Monitor IO throughput (read/write bytes).
- Simple integration with Serilog.
Installation
Install the desired package from NuGet:
# For IO metrics
dotnet add package Serilog.Enrichers.Metrics.IO
# For memory metrics
dotnet add package Serilog.Enrichers.Metrics.Memory
Usage
Add the enricher to your Serilog configuration in code:
using Serilog;
var logger = new LoggerConfiguration()
.Enrich.WithIoMetrics()
.Enrich.WithMemoryMetrics()
.WriteTo.Console(
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u4}] {Message} | Read Bytes {IoReadBytes:N0} | Write Bytes {IoWriteBytes:N0} | WorkingSet {WorkingSetBytes:N0} | Managed {ManagedMemoryBytes:N0} | {Properties:j} {NewLine}{Exception}")
.CreateLogger();
Example: appsettings.json
You can also configure the enrichers using appsettings.json:
{
"Serilog": {
"Using": [
"Serilog.Enrichers.Metrics.IO",
"Serilog.Enrichers.Metrics.Memory"
],
"Enrich": [
"WithIoMetrics",
"WithMemoryMetrics"
],
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u4}] {Message} | Read Bytes {IoReadBytes:N0} | Write Bytes {IoWriteBytes:N0} | WorkingSet {WorkingSetBytes:N0} | Managed {ManagedMemoryBytes:N0} | {Properties:j} {NewLine}{Exception}"
}
}
]
}
}
Created from JandaBox | Icon created by Freepik - Flaticon
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Serilog (>= 4.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.0 | 356 | 9/28/2025 |
| 0.1.1-stopwatch-enricher.3 | 132 | 9/28/2025 |
| 0.1.1-stopwatch-enricher.1 | 131 | 9/28/2025 |
| 0.1.1-main.1 | 126 | 9/28/2025 |
| 0.1.0 | 183 | 9/28/2025 |
| 0.1.0-memory-enricher.8 | 130 | 9/28/2025 |
| 0.1.0-main.4 | 134 | 9/28/2025 |