Skip to content

Commit

Permalink
refactor(server/logger): remove text formatting from hostname (overex…
Browse files Browse the repository at this point in the history
  • Loading branch information
jellyton255 authored Jul 23, 2023
1 parent 65a7990 commit 2fafee4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion imports/logger/server.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
local service = GetConvar('ox:logger', 'datadog')
local hostname = GetConvar('sv_projectName', 'fxserver')
local buffer
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 function base64encode(data)
Expand Down

0 comments on commit 2fafee4

Please sign in to comment.