1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-11-20 02:18:20 +01:00
antd-web-apps/silk/BaseObject.lua

34 lines
699 B
Lua
Raw Permalink Normal View History

2018-08-22 19:38:36 +02:00
BaseObject = Object:extends{registry = {}, class="BaseObject"}
2018-08-27 20:10:53 +02:00
function BaseObject:subclass(name, args)
_G[name] = self:extends(args)
_G[name].class = name
end
2018-08-22 19:38:36 +02:00
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
2018-08-27 20:10:53 +02:00
function BaseObject:print()
print(self.class)
end
2018-08-22 19:38:36 +02:00
function BaseObject:error(msg, trace)
html()
2018-08-28 10:49:12 +02:00
--local line = debug.getinfo(1).currentline
2018-08-22 19:38:36 +02:00
echo(msg)
self:log(msg,"ERROR")
if trace then
debug.traceback=nil
error(msg)
else
error(msg)
end
return false
2018-08-22 19:38:36 +02:00
end