mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
Integrate fmt into log
This commit is contained in:
parent
3126de2c37
commit
3a9f438390
5 changed files with 44 additions and 27 deletions
|
|
@ -220,7 +220,24 @@ local function fmt(template, ...)
|
|||
return buffer:finish()
|
||||
end
|
||||
|
||||
--[[
|
||||
Wrap the given object in a type that implements the given function as its
|
||||
Debug implementation, and forwards __tostring to the type's underlying
|
||||
tostring implementation.
|
||||
]]
|
||||
local function debugify(object, fmtFunc)
|
||||
return setmetatable({}, {
|
||||
__fmtDebug = function(_, ...)
|
||||
return fmtFunc(object, ...)
|
||||
end,
|
||||
__tostring = function()
|
||||
return tostring(object)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
debugOutputBuffer = debugOutputBuffer,
|
||||
fmt = fmt,
|
||||
debugify = debugify,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue