summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/utils.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/sandbox/modules/utils.lua')
-rw-r--r--xmake/core/sandbox/modules/utils.lua32
1 files changed, 0 insertions, 32 deletions
diff --git a/xmake/core/sandbox/modules/utils.lua b/xmake/core/sandbox/modules/utils.lua
index b2f9a682a..d010f2c22 100644
--- a/xmake/core/sandbox/modules/utils.lua
+++ b/xmake/core/sandbox/modules/utils.lua
@@ -43,8 +43,6 @@ sandbox_utils.ifelse = utils.ifelse
-- print each arguments
function sandbox_utils._print(...)
-
- -- format each arguments
local args = {}
for _, arg in ipairs({...}) do
if type(arg) == "string" then
@@ -53,11 +51,7 @@ function sandbox_utils._print(...)
table.insert(args, arg)
end
end
-
- -- print multi-variables with raw lua action
utils._print(table.unpack(args))
-
- -- write to the log file
log:printv(table.unpack(args))
end
@@ -69,58 +63,38 @@ function sandbox_utils.print(format, ...)
-- print format string
if type(format) == "string" and format:find("%", 1, true) then
-
local args = {...}
try
{
function ()
- -- attempt to format message
local message = vformat(format, table.unpack(args))
-
- -- trace
utils._print(message)
-
- -- write to the log file
log:printv(message)
end,
catch
{
function (errors)
- -- print multi-variables with raw lua action
sandbox_utils._print(format, table.unpack(args))
end
}
}
else
- -- print multi-variables with raw lua action
sandbox_utils._print(format, ...)
end
end
-- print format string and the builtin variables without newline
function sandbox_utils.printf(format, ...)
-
- -- init message
local message = vformat(format, ...)
-
- -- trace
utils._iowrite(message)
-
- -- write log to the log file
log:write(message)
end
-- print format string, the builtin variables and colors with newline
function sandbox_utils.cprint(format, ...)
-
- -- init message
local message = vformat(format, ...)
-
- -- trace
utils._print(colors.translate(message))
-
- -- write log to the log file
if log:file() then
log:printv(colors.ignore(message))
end
@@ -128,14 +102,8 @@ end
-- print format string, the builtin variables and colors without newline
function sandbox_utils.cprintf(format, ...)
-
- -- init message
local message = vformat(format, ...)
-
- -- trace
utils._iowrite(colors.translate(message))
-
- -- write log to the log file
if log:file() then
log:write(colors.ignore(message))
end