mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-16 16:21:30 +02:00
initial commit
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
-- Minimal logger; warnings are collected so debug overlays can show them.
|
||||
|
||||
local Logger = { history = {} }
|
||||
|
||||
local function emit(level, fmt, ...)
|
||||
local msg = select("#", ...) > 0 and string.format(fmt, ...) or fmt
|
||||
local line = string.format("[%s] %s", level, msg)
|
||||
print(line)
|
||||
table.insert(Logger.history, line)
|
||||
if #Logger.history > 200 then
|
||||
table.remove(Logger.history, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function Logger.info(fmt, ...) emit("info", fmt, ...) end
|
||||
function Logger.warn(fmt, ...) emit("warn", fmt, ...) end
|
||||
function Logger.error(fmt, ...) emit("error", fmt, ...) end
|
||||
|
||||
return Logger
|
||||
Reference in New Issue
Block a user