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 UGCLogSystem.Print(string.format(Fmt, ...)) 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 function UGCLogSystem.LogCustom(color, fmt, ...) if DefaultSettings.EnableTest then GameState:CustomLog(color, fmt, ...); end 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