1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-12-26 17:38:21 +01:00
antd-web-apps/silk/BaseObject.lua
Xuan Sang LE 692d437c67 fix
2018-08-28 10:49:12 +02:00

34 lines
699 B
Lua

BaseObject = Object:extends{registry = {}, class="BaseObject"}
function BaseObject:subclass(name, args)
_G[name] = self:extends(args)
_G[name].class = name
end
function BaseObject:log(msg, level)
level = level or "INFO"
if self.registry.logger then
self.registry.logger:log(msg,level)
end
end
function BaseObject:debug(msg)
self:log(msg, "DEBUG")
end
function BaseObject:print()
print(self.class)
end
function BaseObject:error(msg, trace)
html()
--local line = debug.getinfo(1).currentline
echo(msg)
self:log(msg,"ERROR")
if trace then
debug.traceback=nil
error(msg)
else
error(msg)
end
return false
end