Skip to content

Commit

Permalink
refactor: remove compat event
Browse files Browse the repository at this point in the history
  • Loading branch information
solareon committed Dec 7, 2023
1 parent ab104f0 commit 74e8794
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
18 changes: 0 additions & 18 deletions bridge/qb/server/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,4 @@ RegisterServerEvent('baseevents:leftVehicle', function(veh, seat, modelName, net
event = 'Left'
}
TriggerClientEvent('QBCore:Client:VehicleInfo', src, data)
end)

---Compatability event for logging
---@param name string source of the log. Usually a playerId or name of a script.
---@param title string the action or 'event' being logged. Usually a verb describing what the name is doing. Example: SpawnVehicle
---@param message string the message attached to the log
---@param color? string what color the message should be
---@param tagEveryone? boolean Whether a role tag should be applied to this log. Uses config variable for logging role
---@deprecated use logger module from qbx_core
RegisterNetEvent('qb-log:server:CreateLog', function(name, title, color, message, tagEveryone)
logger.log({
source = GetInvokingResource() or "qbx_core",
webhook = name,
event = title,
message = message,
color = color,
tags = tagEveryone and config.logging.role or nil
})
end)
10 changes: 3 additions & 7 deletions modules/logger.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
local loggingConfig = require 'config.server'.logging
local isServer = IsDuplicityVersion()
if not isServer then
lib.print.error('cannot use the logger on the client')
Expand Down Expand Up @@ -140,21 +139,18 @@ end
---@field source string source of the log. Usually a playerId or name of a resource.
---@field event string the action or 'event' being logged. Usually a verb describing what the name is doing. Example: SpawnVehicle
---@field message string the message attached to the log
---@field webhook? string Discord logs only. shortname of the webhook this log should send to. looks up via config
---@field webhook? string Discord logs only. url of the webhook this log should send to. looks up via config
---@field color? string Discord logs only. what color the message should be
---@field tags? string[] Discord logs only. tags in discord. Example: {'<@%roleid>', '@everyone'}

---Creates a log using either ox_lib logger, discord webhooks depending on convar
---@param log Log
local function createLog(log)
if loggingConfig.enableWebhooks then
log.webhook = loggingConfig.webhook[log.webhook] or loggingConfig.webhook['default']
if log.webhook then
---@diagnostic disable-next-line: param-type-mismatch
discordLog(log)
end
if loggingConfig.enableOxLogging then
lib.logger(log.source, log.event, log.message)
end
lib.logger(log.source, log.event, log.message) -- oxlib fails silently if logging isn't setup correctly.
end

return {
Expand Down

0 comments on commit 74e8794

Please sign in to comment.