Resources
Modules
logger

logger

See the ox_lib Logger (opens in a new tab) for further details.

Adds a logger that logs to Discord if a webhook is given, and with ox_lib otherwise.

local logger = require '@qbx_core.modules.logger'
 
logger.log(log)
  • log: table
    • source: string
      • The source of the log; usually a player ID or the name of a resource.
    • event: string
      • The action or event being logged; usually a verb describing what the name is doing.
      • Example: 'SpawnVehicle'
    • message: string
      • A message attached to the log.
    • webhook?: string
      • Discord logs only.
      • The URL of the webhook that this should log to.
    • color?: string
      • Discord logs only.
      • The color the message should be.
    • tags?: string[]
      • Discord logs only.
      • Tags to be added to the Discord message.
      • Example: { '<@&roleid>', '<@userid>', '@everyone' }

Example Usage

local logger = require '@qbx_core.modules.logger'
 
logger.log({
  source = 'my source',
  event = 'my event',
  message = 'my message',
  tags = { '@everyone' },
})