添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
istailcall = true , lastlinedefined = 16 , source = @ service / db / db_interactionemotion.lua , linedefined = 7 , currentline = 11 , ntransfer = 0 , short_src = service / db / db_interactionemotion.lua , ftransfer = 0 , nups = 3 , nparams = 0 ,

lua中需要打印行号多半是日志需求,下面是一个demo:

local logger_api = require 'common.logger_api'
local tag = "test"
local test_id = 0
local M = {}
local function get_debuginfo(info)
    --utils.var_dump(info)
    local d = ""
    if info ~= nil and info.short_src ~= nil and info.currentline ~= nil then
      d =  info.short_src .. ":" .. info.currentline .. ":"
    return d
function M.ELOG(...)
    local info = debug.getinfo(2)
    local d = get_debuginfo(info)
    logger_api.ERROR(string.format("%s[E]no_%s_%s",d,test_id,tag),...)
function M.WLOG(...)
    local info = debug.getinfo(2)
    local d = get_debuginfo(info)
    logger_api.WARN(string.format("%s[W]no_%s_%s",d,test_id,tag),...)
function M.NLOG(...)
    logger_api.INFO(string.format("[N]no_%s_%s", test_id,tag), ...)
function M.DLOG(...)
    local info = debug.getinfo(2)
    local d = get_debuginfo(info)
    logger_api.DEBUG(string.format("%s[D]no_%s_%s",d,test_id,tag),...)
return M