summaryrefslogtreecommitdiff
path: root/xmake/core/ui/log.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-12-07 22:46:25 +0800
committerruki <[email protected]>2017-12-08 14:10:23 +0800
commitcb44535305f596bd757ffb58e5ae3cde6d3589fa (patch)
tree343f0ff9287b90204a6a000e0af1a7a1ed6c640b /xmake/core/ui/log.lua
parentabe87994168053e4f420a8b7ab286c65b546eaae (diff)
improve log and add color attrs for curses
Diffstat (limited to 'xmake/core/ui/log.lua')
-rw-r--r--xmake/core/ui/log.lua48
1 files changed, 48 insertions, 0 deletions
diff --git a/xmake/core/ui/log.lua b/xmake/core/ui/log.lua
new file mode 100644
index 000000000..25cbfd7be
--- /dev/null
+++ b/xmake/core/ui/log.lua
@@ -0,0 +1,48 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file log.lua
+--
+
+-- get log
+local log = log or (function ()
+
+ -- load modules
+ local os = require("base/os")
+ local path = require("base/path")
+
+ -- get log directory
+ local logdir = nil
+ if os.isfile(os.projectfile()) then
+ logdir = path.join(os.projectdir(), ".xmake")
+ else
+ logdir = os.tmpdir()
+ end
+
+ -- return module: log
+ local instance = require("base/log")
+ if instance then
+ instance._FILE = nil
+ instance._LOGFILE = path.join(logdir, "ui.log")
+ end
+ return instance
+end)()
+return log