Changed loggin to only log when enabled with logPrint function

This commit is contained in:
bizcochito 2022-02-07 09:36:16 +01:00
parent 75b7aad1e6
commit 89c12b4a0b
4 changed files with 10 additions and 6 deletions

View File

@ -87,3 +87,7 @@ function checkCPUTime(action, name)
end
end
end]]
function logPrint(string)
if logging then print(string) end
end

View File

@ -245,7 +245,7 @@ function GridDisplay()
end
function TileOptimizeObjects()
print("new optimization")
logPrint("new optimization")
local unoptimized = 0
local isTileOptimized = {}
@ -280,7 +280,7 @@ function TileOptimizeObjects()
end
end
print(n)
logPrint("Group size: "..n)
unoptimized = unoptimized + n
local base_x = tileProperties.scale * j * tileProperties.width + tileProperties.scale * (levelProperties.offset.x - tileProperties.height)
local base_y = tileProperties.scale * i * tileProperties.height + tileProperties.scale * (levelProperties.offset.y - tileProperties.height)
@ -297,7 +297,7 @@ function TileOptimizeObjects()
end
end
print("collisions optimized from " .. unoptimized .. " to " .. #LoadedObjects.Collisions)
logPrint("collisions optimized from " .. unoptimized .. " to " .. #LoadedObjects.Collisions)
end
function TileCreateObjects()

View File

@ -59,7 +59,7 @@ function interfaceDialog:checkConfirm()
if love.mouse.isDown(1) then
self.clicked = true
self.value = self.value + 1
print(self.value.." of "..self.target_value)
logPrint(self.value.." of "..self.target_value)
self:updateContents()
end
elseif not love.mouse.isDown(1) then

View File

@ -57,7 +57,7 @@ function love.load()
gravity = 0.2
-- Debug and log stuff
memoryUsage, dtcount = 0, 0
if logging then print("mothback: "..collectgarbage("count").." kB, Loading time: "..os.clock().." seconds") end
logPrint("mothback: "..collectgarbage("count").." kB, Loading time: "..os.clock().." seconds")
end
function love.update(dt)
@ -81,7 +81,7 @@ function love.update(dt)
if debug or logging then
memoryUsage = math.floor(collectgarbage("count"))
end
if logging then print("Second "..secs..": "..memoryUsage.." kB") end
logPrint("Second "..secs..": "..memoryUsage.." kB")
end
--keypressed