diff options
author | chai <chaifix@163.com> | 2018-07-31 14:05:14 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-07-31 14:05:14 +0800 |
commit | 6d8683c933c55fa117b465c4e35b08c28143ef1c (patch) | |
tree | f660774bd225dded94d6cb8a3e9737d2d650bdac /Debug/init.lua | |
parent | 2542f56bca2556b4393d382688be74c1612b2862 (diff) |
*update
Diffstat (limited to 'Debug/init.lua')
-rw-r--r-- | Debug/init.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Debug/init.lua b/Debug/init.lua new file mode 100644 index 0000000..86a192e --- /dev/null +++ b/Debug/init.lua @@ -0,0 +1,27 @@ +-- 不能使用 debug 命名模块,会冲突, +-- 要使用其余名字比如 Debug +local debug = {} +io.stdout:setvbuf("no") + +debug.LEVEL = { + INFO = 4, + DEBUG = 3, + WARN = 2, + ERROR = 1, + NONE = 0 +} + +debug.level = debug.LEVEL.INFO + +debug.strict = function(level) + debug.level = level +end + +debug.log = function(level, fmt, ...) + if level <= debug.level then + local msg = string.format(fmt, ...) + print(msg) + end +end + +return debug
\ No newline at end of file |