50 lines
1.3 KiB
Lua
Raw Permalink Normal View History

2025-01-04 23:00:19 +08:00
UGCLogSystem = UGCLogSystem or {}
UGCLogSystem.EnableLog = true
function UGCLogSystem.SetEnableLog(isEnable)
UGCLogSystem.EnableLog = isEnable
end
function UGCLogSystem.LogTag()
return "[UGCLogSystem] " .. (UGCGameSystem.IsServer() and "[Server]" or "[Client]")
end
function UGCLogSystem.Print(Log)
if not UGCLogSystem.EnableLog then return end
print(Log)
end
function UGCLogSystem.Log(Fmt, ...)
if not UGCLogSystem.EnableLog then return end
local LogStr = UGCLogSystem.LogTag()..string.format(Fmt, ...)
UGCLogSystem.Print(LogStr)
end
function UGCLogSystem.LogTree(Fmt, OutTable)
if not UGCLogSystem.EnableLog then return end
log_tree(Fmt, OutTable)
end
function UGCLogSystem.UGCLog(Fmt, ...)
if not UGCLogSystem.EnableLog then return end
ugcprint(string.format(Fmt, ...));
end
function UGCLogSystem.LogError(Fmt, ...)
if not UGCLogSystem.EnableLog then return end
local LogStr = UGCLogSystem.LogTag().."[LogicError]"..string.format(Fmt, ...)
UGCLogSystem.Print(LogStr)
end
local function StringJoin(InList, add)
local str = '';
for i, v in pairs(InList) do
str = str .. v .. add;
end
return str;
end
function UGCLogSystem.LogItemData(fmt, itemData, ...)
-- 组装成一个列表
--UGCLogSystem.Print(fmt .. StringJoin({...}, " = %s"), )
end