Logger
The Logger
class provides a highly configurable logging system for Luau, supporting:
- Multiple log levels (Debug, Info, Notice, Warn, Error, etc.)
- ANSI color formatting (for compatible environments)
- Timestamps and traceback inclusion
- Per-script and global logger configurations
- Rich object serialization and formatting
Logger is designed for use in both development tooling and in-engine debugging (e.g. Roblox).
Basic Usage
local logger = Console.new("MyScript")
logger:Info("Hello, world!")
logger:Warn("This is a warning!")
logger:Error("This is an error.")
Custom Configuration
local logger = Console.new("MyGameScript", {
LogLevel = "Info",
Timestamps = true,
ANSI = true,
Tracebacks = true,
Format = "[%*][%*][%*][%*]: %*%*%*",
})
Properties
Name
Logger.Name :: string (opens in a new tab)
The name of this logger instance, used for configuration routing and logging output.
Methods
Debug
Logger:Debug(
...
any ) -> ()
Logs a debug message (priority 7). Used during development; typically suppressed in production.
Info
Logger:Info(
...
any ) -> ()
Logs an informational message (priority 6). Useful for tracking general application events.
Notice
Logger:Notice(
...
any ) -> ()
Logs a notice message (priority 5). Indicates noteworthy events that are not errors.
Warn
Logger:Warn(
...
any ) -> ()
Logs a warning message (priority 4). Something unexpected occurred, but the application can continue.
Error
Logger:Error(
...
any ) -> ()
Logs an error message (priority 3). Indicates application errors.
Critical
Logger:Critical(
...
any ) -> ()
Logs a critical error (priority 2). Indicates severe issues like subsystem failure.
Alert
Logger:Alert(
...
any ) -> ()
Logs an alert (priority 1). Requires immediate attention, such as a corrupted database.
Emergency
Logger:Emergency(
...
any ) -> ()
Logs an emergency (priority 0). System is unusable.
Stringify
Logger:Stringify(
value
any ) -> string (opens in a new tab)
Converts the provided value to a human-readable string with type annotations and formatting. Supports primitives, Roblox instances, CFrames, tables, and more.
Configure
Logger:Configure(
config
Configuration ) -> ()
Applies per-instance configuration overrides for this logger. Useful for setting ANSI, format string, log level, etc. for just one logger.