feat(core/debug): add log functions

This commit is contained in:
Kazhnuz 2019-07-24 11:19:10 +02:00
parent 88526282ea
commit 543247e721
2 changed files with 24 additions and 0 deletions

View file

@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add a gamesystem module
- **core/debug:** add log functions
### Changed
- **world:** extract map module from the world module

View file

@ -36,4 +36,26 @@ function DebugSystem:update(dt)
lovebird.update(dt)
end
-- PRINT FUNCTIONS
-- Print and log debug string
function DebugSystem:print(context, string)
if (self.active) then
print("[DEBUG] ".. context .. ": " .. string)
end
end
function DebugSystem:warning(context, string)
if (self.active) then
print("[WARNING] " .. context .. ": " .. string)
end
end
function DebugSystem:error(context, string)
if (self.active) then
error("[ERROR] " .. context .. ": " .. string)
end
end
return DebugSystem