Documentation / Using logs on the server

Using logs on the server

How to log events from your FiveM scripts and view them in the panel.

Adictos_WebLogs centralises your server’s events. Many logs are generated automatically (ox inventory, connections, vehicles…), but you can log your own from any script using the resource’s exports.

Automatic ox_inventory logs

With the ox_lib integration, inventory movements reach the panel on their own when Adictos_WebLogs is started. WebLogs interprets them (locker, trunk, give item…) and groups them; no extra code is needed in your scripts.

ox_inventory (lib.logger)
    │
    ▼
ox_lib/imports/logger/server.lua  ← adapted (Adictos_WebLogs)
    │
    ▼
Adictos_WebLogs (buffer → panel)
    │
    ▼
Web panel (processing + Logs view)

Logging from another script

From the server side of any resource, with Adictos_WebLogs started. There are two common ways:

Log() — you provide the player data

Useful when you already have xPlayer or want to control the licence, IC name and OOC name yourself. Check that the resource is running before calling:

if GetResourceState('Adictos_WebLogs') == 'started' then
    exports['Adictos_WebLogs']:Log('inventory', 'item_give', {
        license = xPlayer.identifier,   -- sin prefijo license:
        playerName = xPlayer.getName(),
        playerOOC = GetPlayerName(source),
        details = 'Entregó 5x pan',
        severity = 'INFO',              -- DEBUG | INFO | WARNING | ERROR | CRITICAL
    }, true)  -- true = enviar a Discord si la categoría tiene webhook
end

LogPlayer() — the resource fills in the player

Pass the player’s source and WebLogs gets the licence and names automatically. Less code when the event comes from a connected player:

exports['Adictos_WebLogs']:LogPlayer(source, 'jobs', 'duty_on', {
    details = 'Entró de servicio',
}, true)

Categories

Every log belongs to a category: it groups events in the panel (GENERAL view, filters, player profile) and, if you want, in a separate Discord channel. The call Log(categoría, acción, datos) uses two different identifiers:

  • Category (1st parameter) — server-level event type: inventory, vehicles, jobs, anticheat… It must exist in the panel and be active.
  • Action (2nd parameter) — what happened within that category: item_give, duty_on, vehicle_delete… You define it in the script; it is used for filtering and searching.

Categories are created under My servers → Categories. In the table, the Category column is the technical identifier (short lowercase text, no spaces: inventory, vehicles…). That same text is the 1st parameter of Log() — it must match letter for letter. The category name is only for display in the panel; the webhook is optional.

-- Ejemplo: categoría 'jobs', acción 'duty_on'
exports['Adictos_WebLogs']:Log('jobs', 'duty_on', { details = 'Entró de servicio' }, true)

-- Ver qué categorías tiene tu servidor ahora mismo
for _, categoria in ipairs(exports['Adictos_WebLogs']:GetCategoryIds()) do
    print(categoria)
end

local meta = exports['Adictos_WebLogs']:GetCategoryMeta('inventory')
-- meta.name, meta.icon, meta.color
If the category identifier doesn’t exist in the panel or is disabled, the log may not appear where you expect or may fall into general. Create and enable it before using it in your scripts.

Useful log fields

FieldDescription
licensePlayer licence (hex, without license:)
playerName / playerOOCIC name and Steam name
targetLicense / targetNameAnother player involved
details / reasonDescriptive text of the event
itemsItems table (name, amount…)
amountNumeric amount (money, etc.)
locationCoordinates or area
severityDEBUG, INFO, WARNING, ERROR or CRITICAL
videoDuration in ms to record the player’s screen (server_id required)

Helpers and alternative events

To connect other resources easily there is shared/integration.lua. The full guide (events, vehicles, delete hook) is in Integration API.

-- Resumen rápido (ver guía completa en /documentation/integration-api)
shared_scripts { '@Adictos_WebLogs/shared/integration.lua' }

AdictosWebLogs.logPlayer(source, 'jobs', 'duty_on', { details = 'Entró de servicio' })

Data flow

Your script (export Log)
    │
    ▼
Adictos_WebLogs (in-memory buffer)
    │ periodic send to the panel
    ▼
Web panel (database)
    │
    ├─► Logs view / player profile
    └─► Discord (if the category has a webhook)

Where to see logs in the panel

ViewUse
Logs → GENERALAll server events by category
Player profileHistory of a specific player
The FiveM → panel connection is validated by the IP registered under My servers. You don’t need an API key in the Lua.