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).
Exports
Section titled “Exports”-- 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 infoexports.spawnbase:LogMessage("Server started", {})Metadata that does more
Section titled “Metadata that does more”| 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. |
Datasets
Section titled “Datasets”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.
Automatic events
Section titled “Automatic events”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.
Sessions
Section titled “Sessions”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.