2025-01-04 23:00:19 +08:00

37 lines
1.0 KiB
Lua

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