Skip to main content

rlog package

Context-based server-side logging framework for ROBLOX projects.

Remarks

Exports the RLog class as the primary entry point.

Classes

Class

Description

LogContext

Context for a collection of log entries.

RLog

Class for server-side Roblox Logging.

Enumerations

Enumeration

Description

LogLevel

Enum representing the various log levels, or "importance" of a LogEntry.

Functions

Function

Description

fileTagEnricher(entry)

Enricher for adding a tag to a log matching the file path, if absent.

functionTagEnricher(entry)

Enricher for adding a tag to a log matching the function name, if absent.

robloxConsoleSink(params)

The default sink for sending messages to the roblox console.

sourceMetadataEnricher(entry)

Attaches source_metadata to the output of a log entry.

withLogContext(config, callback)

Wraps around a callback, automatically creating and managing the lifecycle for a LogContext.

withLogContext(callback)

Wraps around a callback, automatically creating and managing the lifecycle for a LogContext.

withLogContextAsync(config, callback)

Wraps around an async callback, automatically creating and managing the lifecycle for a LogContext.

withLogContextAsync(callback)

Wraps around an async callback, automatically creating and managing the lifecycle for a LogContext.

Interfaces

Interface

Description

LogEntry

A single logging event.

RLogConfig

Configuration settings for RLog.

RLogConstructorParameters

Table version of the constructor parameters for RLog.

RobloxConsoleSinkConfig

Configuration options for robloxConsoleSink().

SerializationConfig

Configuration settings for serialization.

SourceMetadata

Metadata used in identifying where in the source code a log occurred.

Variables

Variable

Description

rLogger

Mapping to RLog.default for easier default usage.

Type Aliases

Type Alias

Description

ContextCallback

A callback that take in a LogContext and optionally returns a value.

FormatMethodCallback

Type representing a callback function for converting log entries to output.

LogData

Type representing the additional data associated with a log entry.

LogEnricherCallback

Type representing a callback function for enriching log entries, or an "enricher".

Enrichers optionally mutate LogEntrys. You can add data to a LogEntry, edit its metadata, or just return it if you don't need to do anything.

LogSinkCallback

Type representing a callback function for consuming log entries, or a "sink".

Sinks are generally used to send logs to an external database or service, but they can also be used to filter logs by "consuming" them.

If your callback returns true, then the log will be stopped, and no further sinks will be called. The LogEntry will also not be logged to the console.

OutputMethodCallback

Type representing a callback function for sending a log to the roblox console.

PartialRLogConfig

Version of RLogConfig that allows all data to be absent.