Commit 9f189ea8 authored by duncathan salt's avatar duncathan salt

improves log generation - in future it will be easy to disable spoilers

parent c6efbb22
This diff is collapsed.
......@@ -13,7 +13,7 @@ lg = love.graphics
U = require 'util'
local LOG_LEVEL, _logCounts, _logLines = 3, nil, nil
local LOG_LEVEL, _logCounts, _logLines = 4, nil, nil
local function _log(level, prefix, text, ...)
if LOG_LEVEL >= level then
local text = prefix .. text
......@@ -25,16 +25,17 @@ end
function logError(...) _log(1, 'ERROR: ', ...) end
function logWarning(...) _log(2, 'WARNING: ', ...) end
function logNotice(...) _log(3, 'NOTICE: ', ...) end
function logInfo(...) _log(4, 'INFO: ', ...) end
function logDebug(...) _log(5, 'DEBUG: ', ...) end
function logSpoiler(...) _log(4, 'SPOILER: ', ...) end
function logInfo(...) _log(5, 'INFO: ', ...) end
function logDebug(...) _log(6, 'DEBUG: ', ...) end
function countLogWarningsAndErrors()
return _logCounts[2], _logCounts[1]
end
function getLogText()
return table.concat(_logLines, "\n\r")
return table.concat(_logLines, "\r\n")
end
function resetLog()
_logCounts = {0, 0, 0, 0, 0}
_logCounts = {0, 0, 0, 0, 0, 0}
_logLines = {}
end
resetLog()
......
......@@ -118,6 +118,7 @@ function C:_shuffleItems(tscFiles)
assert(#self.worldGraph:getEmptyLocations() == 0, self.worldGraph:emptyString() .. "\r\n" .. self.itemDeck:unplacedString())
self.worldGraph:writeItems(tscFiles)
self.worldGraph:logLocations()
end
function C:_fillItems(items, locations)
......@@ -165,7 +166,6 @@ function C:_writeLog()
local path = self:_getWritePath() .. '/log.txt'
local data = getLogText()
U.writeFile(path, data)
print("\n")
end
function C:_getWritePath()
......
......@@ -40,9 +40,6 @@ function C:hasUnreplacedItems()
end
function C:placeItemAtLocation(item, location)
local template = '[%s] "%s" -> "%s"'
logNotice(template:format(location.map, location.name, item.name))
local wasChanged
self._text, wasChanged = self:_stringReplace(self._text, "<EVE....", item.script, location.event)
if not wasChanged then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment