summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-10-16 23:35:55 +0800
committerruki <[email protected]>2017-10-16 15:35:31 +0800
commitc90ccdbf3a81822a660390298d5a5a442c8a496d (patch)
tree79b59f76644f2bb00949a3d2f5e8d7dab8833700
parenta08d6c9117e33b2742ce992f8217090bdcdd568f (diff)
improve log
-rw-r--r--xmake/core/base/log.lua2
-rw-r--r--xmake/core/base/utils.lua7
2 files changed, 6 insertions, 3 deletions
diff --git a/xmake/core/base/log.lua b/xmake/core/base/log.lua
index 186a4ce30..e9b05f8c1 100644
--- a/xmake/core/base/log.lua
+++ b/xmake/core/base/log.lua
@@ -48,7 +48,7 @@ function log.file()
end
-- open the log file
- log._FILE = io.open(outputfile, 'w')
+ log._FILE = io.open(outputfile, 'w+')
end
log._FILE = log._FILE or false
end
diff --git a/xmake/core/base/utils.lua b/xmake/core/base/utils.lua
index 49b05ea0a..e28938648 100644
--- a/xmake/core/base/utils.lua
+++ b/xmake/core/base/utils.lua
@@ -147,9 +147,8 @@ function utils.verror(format, ...)
-- enable verbose?
if option.get("verbose") and format ~= nil then
-
- -- trace
utils.cprint("${bright red}error: ${clear}" .. string.tryformat(format, ...))
+ log.flush()
end
end
@@ -159,6 +158,7 @@ function utils.error(format, ...)
-- trace
if format ~= nil then
utils.cprint("${bright red}error: ${clear}" .. string.tryformat(format, ...))
+ log.flush()
end
end
@@ -180,6 +180,9 @@ function utils.warning(format, ...)
utils.cprint(msg)
warnings[msg] = true
end
+
+ -- flush
+ log.flush()
end
-- ifelse, a? b : c