26 lines
534 B
Lua
26 lines
534 B
Lua
---@class Framework.Log
|
|||
|
|
local Log = {}
|
||
|
|
|
||
|
|
local TAG = "[UnrealLuaDemo]"
|
||
|
|
|
||
|
|
local function FormatMessage(level, fmt, ...)
|
||
|
|
local ok, msg = pcall(string.format, tostring(fmt), ...)
|
||
|
|
if not ok then
|
||
|
|
msg = tostring(fmt)
|
||
|
|
end
|
||
|
|
return string.format("%s[%s] %s", TAG, level, msg)
|
||
|
|
end
|
||
|
|
|
||
|
|
function Log.Info(fmt, ...)
|
||
|
|
print(FormatMessage("INFO", fmt, ...))
|
||
|
|
end
|
||
|
|
|
||
|
|
function Log.Warn(fmt, ...)
|
||
|
|
print(FormatMessage("WARN", fmt, ...))
|
||
|
|
end
|
||
|
|
|
||
|
|
function Log.Error(fmt, ...)
|
||
|
|
print(FormatMessage("ERROR", fmt, ...))
|
||
|
|
end
|
||
|
|
|
||
|
|
return Log
|