Debugging

koja-lib includes a debug printer with coloured log levels.


Config.Debug

Enable debug output globally:

-- editable/shared/config.lua
Config.Debug = true

When enabled, internal koja-lib messages are printed to the console (points callbacks, DUI lifecycle, storage events, etc.).


KOJA.Client.Print

Print a formatted debug message to the client console.

KOJA.Client.Print(level, debug, message)
Parameter
Type
Description

level

string

Log level — see table below

debug

boolean

If false, the message is suppressed

message

any

String or table to print (tables are JSON-encoded)

Log Levels

Level
Colour
Use Case

"success"

Green

Successful operations

"error"

Red

Errors and failures

"warn"

Yellow

Warnings and unexpected states

"info"

Blue

Informational messages

"debug"

Cyan

Verbose debug output


Examples

Gate behind Config.Debug

Pass Config.Debug as the second argument so messages only print when debugging is on:

Pass true directly to always print regardless of the config:


Console Output Format

Colours use FiveM's ^n colour codes and render in the F8 console.

Last updated