Logger.lua 595 B

123456789101112131415161718192021222324252627282930313233343536
  1. class "Logger"
  2. function Logger:Logger(...)
  3. for k,v in pairs(arg) do
  4. if type(v) == "table" then
  5. if v.__ptr ~= nil then
  6. arg[k] = v.__ptr
  7. end
  8. end
  9. end
  10. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  11. self.__ptr = Polycore.Logger(unpack(arg))
  12. Polycore.__ptr_lookup[self.__ptr] = self
  13. end
  14. end
  15. function Logger:log(format)
  16. local retVal = Polycore.Logger_log(format.__ptr)
  17. end
  18. function Logger:logw(str)
  19. local retVal = Polycore.Logger_logw(str.__ptr)
  20. end
  21. function Logger:__delete()
  22. Polycore.__ptr_lookup[self.__ptr] = nil
  23. Polycore.delete_Logger(self.__ptr)
  24. end