# Class ServerLogsService | EchoHub Documentation
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.

# 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
  object
  ServerLogsService

Inherited Members
  object.GetType()
  object.ToString()
  object.Equals(object)
  object.Equals(object, object)
  object.ReferenceEquals(object, object)
  object.GetHashCode()

## Constructors

### ServerLogsService(ServerLogsOptions)

    public ServerLogsService(ServerLogsOptions options)

#### Parameters

`options` ServerLogsOptions

## Fields

### RoomTopic

    public const string RoomTopic = "Live server logs — read-only"

#### Field Value

string

### SenderName

Username shown as the sender of streamed log messages.

    public const string SenderName = "server"

#### Field Value

string

## Properties

### Options

    public ServerLogsOptions Options { get; }

#### Property Value

ServerLogsOptions

## Methods

### CanView(ServerRole)

Whether a user with this role may see and join the log room.

    public bool CanView(ServerRole role)

#### Parameters

`role` ServerRole

#### Returns

bool

### 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

`lines` IReadOnlyList<string>
`skipLeadingContinuations` bool
`maxEntries` int

#### Returns

IReadOnlyList<LogBacklogEntry>

### IsLogsChannel(string)

Whether the given channel is the (enabled) live log room.

    public bool IsLogsChannel(string channelName)

#### Parameters

`channelName` string

#### Returns

bool

### 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>