mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
feat(imports/logger): support metadata table for Fivemanage logger (#75)
This commit is contained in:
@@ -128,17 +128,43 @@ if service == 'fivemanage' then
|
||||
end)
|
||||
end
|
||||
|
||||
local metadata = {
|
||||
hostname = hostname,
|
||||
service = event,
|
||||
source = source,
|
||||
}
|
||||
|
||||
local playerTags = formatTags(source, nil)
|
||||
if playerTags and type(playerTags) == 'string' then
|
||||
local tempTable = { string.strsplit(',', playerTags) }
|
||||
for _, v in pairs(tempTable) do
|
||||
local key, value = string.strsplit(':', v)
|
||||
if key and value then
|
||||
metadata[key] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local args = { ... }
|
||||
for _, arg in pairs(args) do
|
||||
if type(arg) == 'table' then
|
||||
for k, v in pairs(arg) do
|
||||
metadata[k] = v
|
||||
end
|
||||
elseif type(arg) == 'string' then
|
||||
local key, value = string.strsplit(':', arg)
|
||||
if key and value then
|
||||
metadata[key] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
bufferSize += 1
|
||||
buffer[bufferSize] = {
|
||||
level = "info",
|
||||
message = message,
|
||||
resource = cache.resource,
|
||||
metadata = {
|
||||
hostname = hostname,
|
||||
service = event,
|
||||
source = source,
|
||||
tags = formatTags(source, ... and string.strjoin(',', string.tostringall(...)) or nil),
|
||||
}
|
||||
metadata = metadata,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user