---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by HUAFEI2.
--- DateTime: 2020/6/12 18:04
---

if PLATFORM_PC then
    function LOG_I(msg, ...)
        local info = debug.getinfo(2);
        local logMsg = string.format("[INFO] [%s:%d] ", info.source, info.currentline) .. msg;
        print(logMsg, ...);
    end

    function LOG_W(msg, ...)
        local info = debug.getinfo(2);
        local logMsg = string.format("[WARN] [%s:%d] ", info.source, info.currentline) .. msg;
        print(logMsg, ...);
    end

    function LOG_E(msg, ...)
        local info = debug.getinfo(2);
        local logMsg = string.format("[ERROR] [%s:%d] ", info.source, info.currentline) .. msg;
        print(logMsg, ...);
    end

else
    function LOG_I(msg,...)
        local sztab = {...}
        local info = debug.getinfo(2);
        local logMsg = string.format("[%s:%d]", info.source, info.currentline) .. msg;
        while true do
            local part = table.remove(sztab,1)
            if part ~= nil then
                logMsg = logMsg.." "..tostring(part)
            else break end
        end
        LuaLogI(logMsg);
    end

    function LOG_W(msg,...)
        local sztab = {...}
        local info = debug.getinfo(2);
        local logMsg = string.format("[%s:%d]", info.source, info.currentline) .. msg;
        while true do
            local part = table.remove(sztab,1)
            if part ~= nil then
                logMsg = logMsg.." "..tostring(part)
            else break end
        end
        LuaLogW(logMsg);
    end

    function LOG_E(msg,...)
        local sztab = {...}
        local info = debug.getinfo(2);
        local logMsg = string.format("[%s:%d]", info.source, info.currentline) .. msg;
        while true do
            local part = table.remove(sztab,1)
            if part ~= nil then
                logMsg = logMsg.." "..tostring(part)
            else break end
        end
        LuaLogE(logMsg);
    end
end

function Traceback(err)
    print("[LUA ERROR]: " .. tostring(err))
    print(debug.traceback())
end