Skip to content

FiveM SDK — logs

Server-side exports. Log calls never throw and never block: entries are buffered per dataset and flushed in batches (500 entries, 512 KB, or 5 seconds, whichever comes first — configuration).

-- Full form: Log(dataset, level, message, metadata?)
exports.spawnbase:Log("economy", "info", "Purchase", { playerSource = 1 })
-- Level shorthands: Info / Warn / Error / Debug (dataset, message, metadata?)
exports.spawnbase:Info("economy", "Purchase", { playerSource = 1, action = "buy", price = 250 })
exports.spawnbase:Warn("anticheat", "Speed flag", { playerSource = 1 })
exports.spawnbase:Error("core", "Save failed", { playerSource = 1 })
exports.spawnbase:Debug("dev", "Tick", {})
-- Legacy shorthand: LogMessage(message, metadata?) → dataset "default", level info
exports.spawnbase:LogMessage("Server started", {})
Key Effect
playerSource / targetSource The SDK attaches that player’s identifiers (license, discord, steam, fivem — never ip by default) and framework identity (citizenid, character name, job on ESX/QBCore/qbox) as _playerIdentifiers. Filter logs by them in the dashboard.
coords Pass { x = …, y = …, z = … } or a vector3; stored as-is and shown on the log’s map view.
anything else Stored as-is; filter with metadata.<key>=<value> queries.

A dataset is a named log stream (economy, anticheat, admin, …). Sending to a dataset that doesn’t exist creates it, subject to your plan’s dataset limit. Keep the set small and meaningful — see log best practices.

Optional, in config.json: player connect/disconnect, chat messages, resource start/stop, txAdmin actions, and ox_inventory actions, each to its own dataset. All off by default.

The resource reports a session to the API on start and heartbeats while running (upstream-compatible /api/sdk/* shape). Session routes are not live on Spawnbase yet — the SDK tolerates that: media and log calls authenticate with your tokens directly and are unaffected.