summaryrefslogtreecommitdiff
path: root/xmake/core/base/log.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-03-30 23:18:22 +0800
committerruki <[email protected]>2026-03-30 23:18:22 +0800
commit637efd500cc64421601aba5d0382616114e5dfcf (patch)
treef92dad6f2f6c4187f46feaa62f66fc8418f8bd14 /xmake/core/base/log.lua
parente8d7d0dfdcb0b3076ed2c26a1324f77d188e43c7 (diff)
update comments
Diffstat (limited to 'xmake/core/base/log.lua')
-rw-r--r--xmake/core/base/log.lua39
1 files changed, 30 insertions, 9 deletions
diff --git a/xmake/core/base/log.lua b/xmake/core/base/log.lua
index 405002286..7995c8b38 100644
--- a/xmake/core/base/log.lua
+++ b/xmake/core/base/log.lua
@@ -21,7 +21,10 @@
-- define module: log
local log = log or {}
--- get the log file
+-- get the log file object
+--
+-- @return the file object
+--
function log:file()
-- disable?
@@ -56,7 +59,10 @@ function log:file()
return self._FILE
end
--- get the output file
+-- get the output log file path
+--
+-- @return the log file path
+--
function log:outputfile()
if self._LOGFILE == nil then
self._LOGFILE = os.getenv("XMAKE_LOGFILE") or false
@@ -64,19 +70,22 @@ function log:outputfile()
return self._LOGFILE
end
--- clear log
+-- clear the log file
function log:clear(state)
if os.isfile(self:outputfile()) then
io.writefile(self:outputfile(), "")
end
end
--- enable log
+-- enable or disable logging
+--
+-- @param state true to enable, false to disable
+--
function log:enable(state)
self._ENABLE = state
end
--- flush log to file
+-- flush log buffer to file
function log:flush()
local file = self:file()
if file then
@@ -92,7 +101,10 @@ function log:close()
end
end
--- print log to the log file
+-- print log with newline to the log file
+--
+-- @param ... the format string and arguments
+--
function log:print(...)
local file = self:file()
if file then
@@ -100,7 +112,10 @@ function log:print(...)
end
end
--- print variables to the log file
+-- print variables to the log file (verbose mode only)
+--
+-- @param ... the variables to print
+--
function log:printv(...)
local file = self:file()
if file then
@@ -120,7 +135,10 @@ function log:printv(...)
end
end
--- printf log to the log file
+-- printf log without newline to the log file
+--
+-- @param ... the format string and arguments
+--
function log:printf(...)
local file = self:file()
if file then
@@ -128,7 +146,10 @@ function log:printf(...)
end
end
--- write log the log file
+-- write raw data to the log file
+--
+-- @param ... the data to write
+--
function log:write(...)
local file = self:file()
if file then