From c90ccdbf3a81822a660390298d5a5a442c8a496d Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 16 Oct 2017 23:35:55 +0800 Subject: improve log --- xmake/core/base/log.lua | 2 +- xmake/core/base/utils.lua | 7 +++++-- 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 -- cgit v1.3.1