onefiverdev/prettylog
Colorful logging library for Luau, designed for terminal output with enhanced formatting, debug information, and customizable log levels.
prettylog
Colorful logging library for Luau, designed for terminal output with enhanced formatting, debug information, and customizable log levels.
Features
log,info,warn,errorutilities- ANSI color support
- Debug-aware logs using
debug.info - Multiple verbosity levels for warnings and errors
- Custom separators for visual grouping
- Lightweight, no dependencies
- Works in Luau / Lune environments
Installation
Using Pesde or simply copying the lib.
local logger = require(path.to.lib)
If you use Pesde:
pesde add onefiverdev/prettylog
pesde install # remember to install dependencies
Usage
Basic Logging
local log = require("prettylog")
log.log("Hello world")
log.info("System started")
Colored Output
log.log("Generic message", log.colors.Cyan)
Warnings
The warning system supports 2 different verbosity levels.
log.warn("Something happened")
log.warn("Something happened", 2)
Behavior:
level 1→ simple warninglevel 2→ includes line number
Errors
Errors are printed with different debug detail levels.
log.error("Something failed")
log.error("Something failed", 2)
log.error("Something failed", 3)
Behavior:
level 1→ plain error messagelevel 2→ includes line numberlevel 3→ includes source file + linelevel 4+→ simplified output
Example:
[src/module.lua] -> ln <28> Something failed
Separator
Used to visually separate log sections.
log.separator()
Custom separator:
log.separator("=")
Debug information
This library uses debug.info to retrieve:
- Source file
- Line number
This allows logs to include contextual debugging information automatically.
Colors
You can access built-in ANSI colors:
log.colors.Cyan
log.colors.BrightRed
log.colors.BrightYellow
log.colors.BrightBlack
Example:
print(log.colors.Cyan .. "Hello" .. log.colors.Reset)
API
lib.log(message: string, color?: string)
Prints a basic log message.
lib.info(message: string)
Prints an informational message in cyan.
lib.warn(message: string, level?: number)
Prints a warning message with optional debug verbosity.
lib.error(message: string, level?: number)
Prints an error message with optional debug context.
lib.separator(character?: string)
Prints a visual separator line.
lib.colorize(text: string, color: string) -> string
Returns colored text without printing.
lib.colors
Table containing ANSI color codes.
Example
local log = require("prettylog")
log.separator()
log.info("Server starting...")
log.warn("Low memory", 2)
log.error("Database connection failed", 3)
log.separator("=")
Notes
- Uses
debug.infofor runtime stack metadata - Designed for terminal environments supporting ANSI escape codes
- Not intended for Roblox Studio output (no ANSI support)