Skip to content

ActionLog

luau
local Operator = require(game:GetService("ServerStorage").Operator)
local ActionLog = Operator.ActionLog

Backs 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

luau
ActionLog.new(options: Options?): ActionLog
luau
local log = ActionLog.new({ audit = audit, bufferSize = 200 })

Without an audit, the general stream is always empty. It is the audit log.

Methods

:record

luau
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

luau
log:query(query: Query?): Page

Newest first. Filters by stream, free-text search, days, and userId, then pages with limit and cursor. See LogRecord.Query.

luau
log:query({ stream = "moderation", search = "bob", days = 7, limit = 40 })

:count

luau
log:count(): number

Moderation actions currently held. Does not count audit records.

:destroy

luau
log:destroy(): ()

Types

Options

luau
type Options = {
	audit: Audit?,
	bufferSize: number?,
	logger: Log.Logger?,
}
FieldDefaultMeaning
auditnonethe Audit the general stream reads from
bufferSize200moderation actions kept before the oldest is dropped
loggersilenta Logger

Entry

luau
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.

Released under the MIT Licence.