ActionLog
local Operator = require(game:GetService("ServerStorage").Operator)
local ActionLog = Operator.ActionLogBacks the log panel. It holds moderation actions in a ring buffer and serves both streams: moderation from its own buffer, general mapped from the Audit log.
Operator.Start builds one and exposes it as handle.logs.
In memory, and per-server
Records live in this server's memory and are gone when it shuts down. One server never sees another's. For durable history, attach an audit sink.
Functions
ActionLog.new
ActionLog.new(options: Options?): ActionLoglocal log = ActionLog.new({ audit = audit, bufferSize = 200 })Without an audit, the general stream is always empty. It is the audit log.
Methods
:record
log:record(entry: Entry): Record?Adds a moderation action and returns the stored record. The dispatcher calls this when a successful command used context:logAction; you would only call it directly when driving dispatch yourself.
:query
log:query(query: Query?): PageNewest first. Filters by stream, free-text search, days, and userId, then pages with limit and cursor. See LogRecord.Query.
log:query({ stream = "moderation", search = "bob", days = 7, limit = 40 }):count
log:count(): numberModeration actions currently held. Does not count audit records.
:destroy
log:destroy(): ()Types
Options
type Options = {
audit: Audit?,
bufferSize: number?,
logger: Log.Logger?,
}| Field | Default | Meaning |
|---|---|---|
audit | none | the Audit the general stream reads from |
bufferSize | 200 | moderation actions kept before the oldest is dropped |
logger | silent | a Logger |
Entry
type Entry = {
action: string,
severity: string,
targetId: number?,
targetName: string,
targetDisplayName: string,
reason: string?,
duration: number?,
moderator: Player?,
moderatorName: string,
moderatorDisplayName: string,
jobId: string,
}moderatorId on the stored record is taken from moderator, never from the entry, so it cannot be supplied by a caller that should not set it.