Logs and uploads
cobalt_core exports: logs and uploads.
Log
ServerQueues a log event for FiveMesh. category becomes the event type (banking.deposit), the calling resource fills resource, and security is sent as warn with a security. type prefix. Queued events go out in batches every 5 seconds and on stop. Returns false when FiveMesh is disabled or the arguments are invalid.
exports.cobalt_core:Log(category, message, data, level)| Parameter | Type | Optional | Description |
|---|---|---|---|
category | string | No | |
message | string | No | up to 2048 characters |
data | table | Yes | JSON object stored with the event |
level | LogLevel | Yes | defaults to info |
| Returns | Description |
|---|---|
boolean | queued |
local queued = exports.cobalt_core:Log(
'garages',
'Vehicle stored in Legion Square garage',
{ plate = 'COBALT01', garage = 'legion' },
'debug'
)LogPlayer
ServerLog with the player's server id, identifiers and citizenid attached, plus a target player's when given.
exports.cobalt_core:LogPlayer(source, category, message, data, level, target)| Parameter | Type | Optional | Description |
|---|---|---|---|
source | integer | No | |
category | string | No | |
message | string | No | |
data | table | Yes | |
level | LogLevel | Yes | |
target | integer | Yes |
| Returns | Description |
|---|---|
boolean | queued |
local queued = exports.cobalt_core:LogPlayer(
source,
'garages',
'Vehicle stored in Legion Square garage',
{ plate = 'COBALT01', garage = 'legion' },
'debug',
targetId
)UploadFile
ServerUploads a Base64 file to the FiveMesh CDN and returns its public URL. Yields; retries 429 and 5xx.
exports.cobalt_core:UploadFile(path, data, contentType)| Parameter | Type | Optional | Description |
|---|---|---|---|
path | string | No | folder and file name, such as uploads/phone/123.webp |
data | string | No | standard Base64 or a data:<type>;base64, URL |
contentType | string | Yes | such as image/webp |
| Returns | Description |
|---|---|
string? | url |
string? | error |
local url, error = exports.cobalt_core:UploadFile(
'screenshots/crash.png',
'base64-encoded file contents',
'image/png'
)Permissions and bans
cobalt_core exports: permissions and bans.
cobalt_mysql
The MariaDB layer, which also answers as oxmysql, mysql-async and ghmattimysql, so exports.oxmysql, exports.ghmattimysql, exports['mysql-async'] and the @oxmysql/lib/MySQL.lua include (MySQL.Async, MySQL.Sync, MySQL.ready) all reach it.