DebugX — The Prettier print()
Let’s be real — Roblox’s default print()
gets the job done… but it’s kinda ugly. No timestamps. No idea where the log came from. And when you’re working on a bigger project? Total mess.
DebugX is a lightweight little module I made to fix all that. It makes your output look 100x cleaner — with timestamps, source info, pretty formatting, and even some emoji flair to make things pop. Just swap in DebugX:Log("your message")
and your console instantly levels up.
DebugX.lua (2.1 KB)
--[[
DebugX: Make print prettier lol
Author: waleedaudemars
Description:
simple project, just makes your print() look prettier, also supports timestamps!
]]
local DebugX = {}
DebugX.__index = DebugX
--// Constants
local SEPARATOR = "✮⋆˙═════════════════ ⋆˚࿔ 𝕯𝖊𝖇𝖚𝖌𝖃 𝜗𝜚˚⋆ ═════════════════✮⋆˙"
local HEADER = "⌞────୨ৎ────────୨ৎ────────୨ৎ────────୨ৎ────────୨ৎ────────୨ৎ───"
--// Utility Functions
--- Returns current timestamp in a clean format
local function getTimestamp(): string
return os.date("%Y-%m-%d %H:%M:%S")
end
--- Attempts to extract the calling script and line number from the traceback
local function getCallerTrace(): string
local trace = debug.traceback()
for line in trace:gmatch("[^\n]+") do
if not line:find("DebugX") and line:find("Script") then
local scriptName, lineNumber = line:match("([^%.]+):(%d+)")
if scriptName and lineNumber then
return scriptName .. ":" .. lineNumber
end
end
end
return "Unknown"
end
--- Nicely formats nested tables with indentation
local function stringify(value: any, indent: number?): string
indent = indent or 0
local prefix = string.rep(" ", indent)
if type(value) ~= "table" then
return tostring(value)
end
local result = {"{"}
for key, val in pairs(value) do
local formattedLine = string.format("%s [%s] = %s", prefix, tostring(key), stringify(val, indent + 1))
table.insert(result, formattedLine)
end
table.insert(result, prefix .. "}")
return table.concat(result, "\n")
end
--- Handles safe output to console with optional warning
local function safeEmit(message: string, asWarning: boolean?)
local emitFunc = asWarning and warn or print
pcall(function() emitFunc(message) end)
end
--// Public API
--- Logs a message with timestamp and source trace, surrounded by separators
function DebugX:Log(message: any)
local timestamp = getTimestamp()
local origin = getCallerTrace()
safeEmit(HEADER)
safeEmit(SEPARATOR)
safeEmit(" 📝 [𝐌𝐞𝐬𝐬𝐚𝐠𝐞] » " .. tostring(message))
safeEmit(" 📍 [𝐎𝐫𝐢𝐠𝐢𝐧] » " .. origin)
safeEmit(SEPARATOR)
end
return DebugX
Feedback is appreciated, let me know what changes i can make to improve this module.