Meziantou.AspNetCore.Components.LogViewer
2.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Meziantou.AspNetCore.Components.LogViewer --version 2.0.0
NuGet\Install-Package Meziantou.AspNetCore.Components.LogViewer -Version 2.0.0
<PackageReference Include="Meziantou.AspNetCore.Components.LogViewer" Version="2.0.0" />
<PackageVersion Include="Meziantou.AspNetCore.Components.LogViewer" Version="2.0.0" />
<PackageReference Include="Meziantou.AspNetCore.Components.LogViewer" />
paket add Meziantou.AspNetCore.Components.LogViewer --version 2.0.0
#r "nuget: Meziantou.AspNetCore.Components.LogViewer, 2.0.0"
#:package Meziantou.AspNetCore.Components.LogViewer@2.0.0
#addin nuget:?package=Meziantou.AspNetCore.Components.LogViewer&version=2.0.0
#tool nuget:?package=Meziantou.AspNetCore.Components.LogViewer&version=2.0.0
Meziantou.AspNetCore.Components.LogViewer
A Blazor component for displaying and analyzing log entries with support for filtering, highlighting, and interactive exploration.
Features
- Display log entries with customizable formatting
- Syntax highlighting for URLs, quoted text, and custom patterns
- Flexible timestamp formats (full datetime, relative time, hidden)
- Interactive log details with table and JSON views
- Line numbers for easy reference
- Log level styling with distinct visual indicators
- Clickable URLs in log messages
- Multi-line log support with expandable details
- ANSI color and style rendering (16-color, 256-color, and truecolor SGR sequences)
Usage
Basic Example
@page "/logs"
@using Meziantou.AspNetCore.Components
<LogViewer Entries="@logEntries" />
@code {
private List<LogEntry> logEntries = new()
{
new LogEntry
{
Timestamp = DateTimeOffset.UtcNow,
Message = "Application started",
LogLevel = LogLevel.Information
},
new LogEntry
{
Timestamp = DateTimeOffset.UtcNow.AddSeconds(1),
Message = "Processing request",
LogLevel = LogLevel.Debug
},
new LogEntry
{
Timestamp = DateTimeOffset.UtcNow.AddSeconds(2),
Message = "An error occurred",
LogLevel = LogLevel.Error
},
};
}
Advanced Example with Configuration
@page "/logs"
@using Meziantou.AspNetCore.Components
<LogViewer
Entries="@logEntries"
TimestampDisplayFormat="TimestampDisplayFormat.DateTimeThenRelativeTime"
ShowLineNumbers="true"
LogHighlighters="@highlighters" />
@code {
private ILogHighlighter[] highlighters = new ILogHighlighter[]
{
new UrlLogHighlighter(),
new QuoteLogHighlighter()
};
private List<LogEntry> logEntries = new()
{
new LogEntry
{
Timestamp = DateTimeOffset.UtcNow,
Message = "Check out https://example.com for more info",
LogLevel = LogLevel.Information
},
new LogEntry
{
Timestamp = DateTimeOffset.UtcNow.AddSeconds(5),
Message = "User 'admin' logged in",
LogLevel = LogLevel.Information
},
};
}
Log Entries with Structured Messages
@code {
private List<LogEntry> logEntries = new()
{
new LogEntry
{
Timestamp = DateTimeOffset.UtcNow,
LogLevel = LogLevel.Information,
Message = new
{
Text = "Request completed with details",
UserId = 123,
Endpoint = "/api/users",
Duration = TimeSpan.FromMilliseconds(245),
Headers = new Dictionary<string, string>
{
{ "User-Agent", "Mozilla/5.0" },
{ "Content-Type", "application/json" }
}
}
},
};
}
When Message is a string, it is displayed as highlighted text. For non-string Message values, the structured payload is rendered inline and can be viewed as either a table or JSON.
ANSI-formatted Messages
LogViewer parses ANSI SGR escape sequences embedded in string messages and renders the corresponding foreground/background colors and text styles.
new LogEntry
{
Timestamp = DateTimeOffset.UtcNow,
LogLevel = LogLevel.Information,
Message = "\u001b[1;33mwarning\u001b[0m \u001b[38;2;100;200;50mcustom color\u001b[0m",
}
Hierarchical / Nested Logs
A LogEntry can contain child entries via the Children property, with an unlimited number of levels.
Each entry is independently collapsible. Set Expanded = true on an entry to make it start expanded
(the default is collapsed). The toggle controls nested children.
@code {
private List<LogEntry> logEntries = new()
{
new LogEntry
{
Timestamp = DateTimeOffset.UtcNow,
Message = "Handling request",
LogLevel = LogLevel.Information,
Expanded = true,
Children = new List<LogEntry>
{
new LogEntry
{
Timestamp = DateTimeOffset.UtcNow,
Message = "Querying database",
LogLevel = LogLevel.Debug,
Children = new List<LogEntry>
{
new LogEntry
{
Timestamp = DateTimeOffset.UtcNow,
Message = "Executing query",
LogLevel = LogLevel.Trace,
},
},
},
},
},
};
}
Line numbers count every entry in the tree (including collapsed children), so the numbers stay stable when you expand or collapse nodes.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. net11.0 is compatible. |
-
net10.0
- Meziantou.Framework.AnsiFormatting (>= 2.0.0)
- Microsoft.AspNetCore.Components (>= 10.0.9)
- Microsoft.AspNetCore.Components.Web (>= 10.0.9)
-
net11.0
- Meziantou.Framework.AnsiFormatting (>= 2.0.0)
- Microsoft.AspNetCore.Components (>= 11.0.0-preview.5.26302.115)
- Microsoft.AspNetCore.Components.Web (>= 11.0.0-preview.5.26302.115)
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 |
|---|---|---|
| 2.0.11 | 74 | 11/13/2026 |
| 2.0.10 | 57 | 11/8/2026 |
| 2.0.9 | 135 | 10/28/2026 |
| 2.0.8 | 66 | 10/21/2026 |
| 2.0.7 | 73 | 10/16/2026 |
| 2.0.6 | 100 | 9/11/2026 |
| 2.0.5 | 98 | 9/6/2026 |
| 2.0.4 | 98 | 8/29/2026 |
| 2.0.3 | 103 | 8/16/2026 |
| 2.0.2 | 103 | 8/9/2026 |
| 2.0.1 | 107 | 7/17/2026 |
| 2.0.0 | 113 | 7/5/2026 |
| 1.0.29 | 104 | 6/28/2026 |
| 1.0.28 | 112 | 6/13/2026 |
| 1.0.27 | 98 | 6/13/2026 |
| 1.0.26 | 107 | 5/31/2026 |
| 1.0.25 | 156 | 5/14/2026 |
| 1.0.24 | 161 | 5/11/2026 |
| 1.0.23 | 147 | 4/25/2026 |
| 1.0.22 | 163 | 3/29/2026 |