LogRecord
local Operator = require(game:GetService("ServerStorage").Operator)
local LogRecord = Operator.LogRecordThe record shapes the log panel reads, and the matching rules it searches with. Shared, so the client renders the same shapes the server produced.
Pure Luau with no Roblox API calls.
Types
Stream
type Stream = "general" | "moderation"general is the audit log rendered; moderation is actions recorded with context:logAction.
GeneralRecord
type GeneralRecord = {
kind: "general",
id: string,
at: number,
jobId: string,
userId: number?,
userName: string,
displayName: string,
command: string,
path: string,
status: string,
ok: boolean,
reported: string?,
}reported is "client" on a client-reported row and absent otherwise.
ModerationRecord
type ModerationRecord = {
kind: "moderation",
id: string,
at: number,
jobId: string,
action: string,
severity: string,
targetId: number?,
targetName: string,
targetDisplayName: string,
reason: string?,
duration: number?,
moderatorId: number?,
moderatorName: string,
moderatorDisplayName: string,
}Record
type Record = GeneralRecord | ModerationRecordSwitch on kind.
Query
type Query = {
stream: Stream?,
search: string?,
days: number?,
userId: number?,
limit: number?,
cursor: Cursor?,
}Cursor
type Cursor = { offset: number }Opaque to callers. Hand back what a Page gave you.
Page
type Page = {
records: { Record },
cursor: Cursor?,
scanned: number,
truncated: boolean,
}cursor is non-nil when more records matched than fit.
Properties
| Property | Value |
|---|---|
LogRecord.Streams | { general = "general", moderation = "moderation" } |
LogRecord.Severities | ban, kick, wipe, warn, custom |
LogRecord.DefaultSeverity | "custom" |
Functions
LogRecord.matches
LogRecord.matches(record: Record, search: string?, userId: number?): booleanWhether a record matches a search. Case-insensitive, substring, and matched against every field a moderator would type: names, display names, user IDs, command text, action, severity, reason and moderator.
An empty or nil search matches everything. A userId matches the record's subject or its moderator, so searching a user finds both what they did and what was done to them.
LogRecord.isStream
LogRecord.isStream(value: any): booleanWhitelist check. Used at the remote boundary before a stream name reaches a query.
LogRecord.isSeverity
LogRecord.isSeverity(value: any): booleanLogRecord.haystack
LogRecord.haystack(record: Record): stringThe lowercased text matches searches. Exposed for building your own filter.
LogRecord.subjectId / LogRecord.moderatorId
LogRecord.subjectId(record: Record): number?
LogRecord.moderatorId(record: Record): number?moderatorId is always nil for a general record.