Log API
Write logs from your own scripts and read them on the Server logs page.
Your scripts write log lines with one export. Lines are collected and sent in batches (every second, or every 500 lines), so a log call never waits. They are stored on your own server and shown on the Server logs page.
Write a line
exports["tgiann-fivem-stats-script"]:Log("bank", "info", "Transfer of $5000", {
playerSource = source,
targetSource = targetId,
amount = 5000,
})
exports["tgiann-fivem-stats-script"]:Warn("anticheat", "Teleport detected", { playerSource = source })Dataset
A group of lines, like bank or anticheat. Letters, digits, _, - and .. Pick it with Dataset on the Server logs page
Level
debug, info, warn or error
Message
The line itself, up to 16 KB
Metadata
A table, up to 32 KB. playerSource and targetSource add the players' identifiers and character, so the page can filter by player
The resource that called the export is stored with the line. All exports with their parameters: Exports.
Levels
Lines below Lowest level kept are dropped before they are sent, from every script. It is info by default, so debug lines are dropped until you lower it. Turn on Print to the server console to also see each line in the FXServer console. Both are in Settings > Logs.
Automatic logs
The script logs these events on its own. Turn each one on or off and choose its dataset in Settings > Logs.
Player joins and leaves
Yes
connections
Chat messages
No
chat
Resource starts and stops
Yes
resources
txAdmin actions (kicks, warns, bans, announcements, restarts)
Yes
txadmin
Scripts written for fmsdk
Log, Info, Warn, Error and LogMessage keep fmsdk's names, so fmsdk logging calls work unchanged.