-
Notifications
You must be signed in to change notification settings - Fork 0
API Documentation
SillyKitr edited this page Jun 20, 2026
·
1 revision
Important
This current wiki is in heavy WIP! Expect missing stuff..
You may temporarily check the source code for the API documentation, it's quite easy to read.
You will find most API documentation in here.
local log = Logger.new({
name = "Server", -- optional, shown in brackets
level = "debug", -- "trace" | "debug" | "info" | "warn" | "error" | "fatal"
colors = true, -- enable ANSI color output
timestamps = true, -- prepend UTC timestamps
sink = function(line, level) -- custom output (default: print)
io.write(line, "\n")
end,
})log:trace("verbose detail")
log:debug("debug info")
log:info("general info")
log:warn("warning")
log:error("error")
log:fatal("fatal error")Multiple arguments are space-joined automatically.
log:getLevel() -- returns current level name
log:setLevel("warn") -- change level at runtime
log:isLevelEnabled("debug") -- check if a level would be loggedUse the module directly as a singleton:
Logger.configure({ name = "App", level = "warn" })
Logger.info("hidden") -- filtered out
Logger.warn("visible")
Logger.getLevel() -- "warn"
Logger.setLevel("trace")| Option | Type | Default | Description |
|---|---|---|---|
name |
string? |
nil |
Logger name shown in brackets |
level |
LevelName? |
"info" |
Minimum level to log |
colors |
boolean? |
false |
Enable ANSI color codes |
timestamps |
boolean? |
false |
Prepend ISO 8601 UTC timestamps |
sink |
((string, LevelName) -> ())? |
print |
Custom output function |
| Level | Value | Color |
|---|---|---|
trace |
10 | Gray |
debug |
20 | Light blue |
info |
30 | Green |
warn |
40 | Yellow |
error |
50 | Bold red |
fatal |
60 | Purple |
kitr/logger | API Documentation