LogViewer
TsgcHTMLComponent_LogViewer — a streaming log / terminal viewer with level filter, search, auto-scroll and dark/light themes, in Delphi, C++ Builder and .NET.
TsgcHTMLComponent_LogViewer — a streaming log / terminal viewer with level filter, search, auto-scroll and dark/light themes, in Delphi, C++ Builder and .NET.
Push lines with AddLine, they are kept in a capped ring buffer, then read the HTML property — or stream new lines to connected clients with GetLastLineFragmentHTML.
TsgcHTMLComponent_LogViewer
Toolbar + terminal-style log body + scoped CSS
Delphi, C++ Builder, .NET
Call AddLine for each entry, read HTML for the initial render, then push new lines to open WebSocket clients with GetLastLineFragmentHTML.
uses
sgcHTML_Component_LogViewer;
var
oLog: TsgcHTMLComponent_LogViewer;
begin
oLog := TsgcHTMLComponent_LogViewer.Create(nil);
try
oLog.LogID := 'applog';
oLog.Theme := ltDark;
oLog.MaxLines := 500;
oLog.Height := '400px';
oLog.AddLine(llInfo, 'Service started', 'app');
oLog.AddLine(llWarning, 'Low disk space', 'monitor');
oLog.AddLine(llError, 'Connection refused', 'db');
WebModule.Response := oLog.HTML; // toolbar + log body + inline script
finally
oLog.Free;
end;
end;
// Push one more line to every connected client, no full re-render:
oLog.AddLine(llInfo, 'New order received', 'orders');
TsgcHTMX_Engine_Server.BroadcastFragment(oLog.GetLastLineFragmentHTML);
// includes: sgcHTML_Component_LogViewer.hpp
TsgcHTMLComponent_LogViewer *oLog = new TsgcHTMLComponent_LogViewer(NULL);
try
{
oLog->LogID = "applog";
oLog->Theme = ltDark;
oLog->MaxLines = 500;
oLog->Height = "400px";
oLog->AddLine(llInfo, "Service started", "app");
oLog->AddLine(llWarning, "Low disk space", "monitor");
oLog->AddLine(llError, "Connection refused", "db");
String html = oLog->HTML; // toolbar + log body + inline script
// Push one more line to every connected client:
oLog->AddLine(llInfo, "New order received", "orders");
TsgcHTMX_Engine_Server::BroadcastFragment(oLog->GetLastLineFragmentHTML());
}
__finally
{
delete oLog;
}
using esegece.sgcWebSockets;
var log = new TsgcHTMLComponent_LogViewer();
log.LogID = "applog";
log.Theme = TsgcHTMLLogTheme.ltDark;
log.MaxLines = 500;
log.Height = "400px";
log.AddLine(TsgcHTMLLogLevel.llInfo, "Service started", "app");
log.AddLine(TsgcHTMLLogLevel.llWarning, "Low disk space", "monitor");
log.AddLine(TsgcHTMLLogLevel.llError, "Connection refused", "db");
string html = log.HTML; // toolbar + log body + inline script
// Push one more line to every connected client, no full re-render:
log.AddLine(TsgcHTMLLogLevel.llInfo, "New order received", "orders");
TsgcHTMX_Engine_Server.BroadcastFragment(log.GetLastLineFragmentHTML());
The members you reach for most often.
AddLine(aLevel, aText, aSource) appends a timestamped entry; MaxLines (default 500) caps the ring buffer and drops the oldest line. Clear empties it.
TsgcHTMLLogLevel — llTrace, llDebug, llInfo, llWarning, llError, llFatal — each colour-coded per Theme.
ShowSearch, ShowLevelFilter and Title control the toolbar; filtering and highlighting run client-side, no round-trip.
AutoScroll follows the newest line; ShowAutoScrollToggle adds a checkbox so the reader can pause following while scrolling back.
GetLastLineFragmentHTML / GetLineFragmentHTML(aIndex) render an out-of-band fragment for TsgcHTMX_Engine_Server.PushFragment / BroadcastFragment.
Theme (ltDark / ltLight), WrapLines, Height, TimeFormat and EmptyText tune the look.
| Online HelpFull API reference and usage guide for this component. | Open | |
| All sgcHTML ComponentsBrowse the full feature matrix of 80+ components. | Open | |
| Download Free TrialThe 30-day trial ships the 60.HTML demo projects. | Open | |
| PricingSingle, Team and Site licenses with full source code. | Open |