Meziantou.AspNetCore.Components.LogViewer
2.0.7
Prefix Reserved
See the version list below for details.
dotnet add package Meziantou.AspNetCore.Components.LogViewer --version 2.0.7
NuGet\Install-Package Meziantou.AspNetCore.Components.LogViewer -Version 2.0.7
<PackageReference Include="Meziantou.AspNetCore.Components.LogViewer" Version="2.0.7" />
<PackageVersion Include="Meziantou.AspNetCore.Components.LogViewer" Version="2.0.7" />
<PackageReference Include="Meziantou.AspNetCore.Components.LogViewer" />
paket add Meziantou.AspNetCore.Components.LogViewer --version 2.0.7
#r "nuget: Meziantou.AspNetCore.Components.LogViewer, 2.0.7"
#:package Meziantou.AspNetCore.Components.LogViewer@2.0.7
#addin nuget:?package=Meziantou.AspNetCore.Components.LogViewer&version=2.0.7
#tool nuget:?package=Meziantou.AspNetCore.Components.LogViewer&version=2.0.7
Meziantou.AspNetCore.Components.LogViewer
A Blazor component for displaying and analyzing log entries with support for 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.
The table view walks the object with reflection: dictionaries are rendered as key/value rows, other sequences as
indexed rows, and anything else by its public instance properties. Indexers are skipped, a property getter that
throws is rendered as an error instead of failing the render, and nesting is capped by MaxDepth (default 32),
which also bounds cyclic object graphs.
Trimming and Native AOT: the table and JSON views use reflection over arbitrary objects, so
LogEntryDetailsis not compatible with trimming or Native AOT. In a trimmed Blazor WebAssembly app, properties of logged types may be removed and silently omitted from the output. Keep the types you log rooted, or pass aDictionary<string, object>instead of an arbitrary object.
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",
}
Highlighters
LogHighlighters receives an ordered collection of ILogHighlighter. Each highlighter returns
LogHighlighterResult values describing a range of the message to mark up. When two results overlap, the one with
the higher Priority wins — even when the other one starts earlier; ties are broken on the lowest index, then on
the longest match.
A result can carry a Link, which turns the range into an anchor. Only http and https links are rendered as
anchors; any other scheme falls back to a plain highlight, so a highlighter cannot inject a javascript: URL into
the page from untrusted log text.
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.3)
- Microsoft.AspNetCore.Components (>= 10.0.12)
- Microsoft.AspNetCore.Components.Web (>= 10.0.12)
-
net11.0
- Meziantou.Framework.AnsiFormatting (>= 2.0.3)
- Microsoft.AspNetCore.Components (>= 11.0.0-rc.2.26504.105)
- Microsoft.AspNetCore.Components.Web (>= 11.0.0-rc.2.26504.105)
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 |