Class ServerLogsService
- Namespace
- EchoHub.Server.Services.ServerLogs
- Assembly
- EchoHub.Server.dll
Shared logic for the live log room: room identity, the role gate, and reading the backlog tail from the current rolling log file. The file stays the only persistence — log lines are never stored as messages.
public sealed class ServerLogsService
- Inheritance
-
ServerLogsService
- Inherited Members
Constructors
ServerLogsService(ServerLogsOptions)
public ServerLogsService(ServerLogsOptions options)
Parameters
optionsServerLogsOptions
Fields
RoomTopic
public const string RoomTopic = "Live server logs — read-only"
Field Value
SenderName
Username shown as the sender of streamed log messages.
public const string SenderName = "server"
Field Value
Properties
Options
public ServerLogsOptions Options { get; }
Property Value
Methods
CanView(ServerRole)
Whether a user with this role may see and join the log room.
public bool CanView(ServerRole role)
Parameters
roleServerRole
Returns
GroupIntoEntries(IReadOnlyList<string>, bool, int)
Groups raw file lines into entries by their timestamp prefix. Public for tests.
public static IReadOnlyList<LogBacklogEntry> GroupIntoEntries(IReadOnlyList<string> lines, bool skipLeadingContinuations, int maxEntries)
Parameters
Returns
- IReadOnlyList<LogBacklogEntry>
IsLogsChannel(string)
Whether the given channel is the (enabled) live log room.
public bool IsLogsChannel(string channelName)
Parameters
channelNamestring
Returns
ReadBacklog()
Reads the last BacklogLines entries from the newest log file. A line starting with a timestamp begins a new entry; continuation lines (stack traces) stay attached to the entry above them. Best-effort: any I/O problem yields an empty backlog rather than failing the join.
public IReadOnlyList<LogBacklogEntry> ReadBacklog()
Returns
- IReadOnlyList<LogBacklogEntry>