refactor(server/logger): remove text formatting from hostname (#361)

This commit is contained in:
Jellyton
2023-07-22 19:59:41 -07:00
committed by GitHub
parent 65a799071a
commit 2fafee41a0

View File

@@ -1,8 +1,22 @@
local service = GetConvar('ox:logger', 'datadog') local service = GetConvar('ox:logger', 'datadog')
local hostname = GetConvar('sv_projectName', 'fxserver')
local buffer local buffer
local bufferSize = 0 local bufferSize = 0
local function removeColorCodes(str)
-- replace ^[0-9] with nothing
str = string.gsub(str, "%^%d", "")
-- replace ^#[0-9A-F]{3,6} with nothing
str = string.gsub(str, "%^#[%dA-Fa-f]+", "")
-- replace ~[a-z]~ with nothing
str = string.gsub(str, "~[%a]~", "")
return str
end
local hostname = removeColorCodes(GetConvar('ox:logger:hostname', GetConvar('sv_projectName', 'fxserver'))
local b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" local b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
local function base64encode(data) local function base64encode(data)