overleaf/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogs.coffee

15 lines
543 B
CoffeeScript

define [
"libs/latex-log-parser"
"ide/human-readable-logs/HumanReadableLogsRules"
], (LogParser, ruleset) ->
parse : (rawLog, options) ->
parsedLogEntries = LogParser.parse(rawLog, options)
_getHumanReadableMessage = (logMessage) ->
return rule.humanReadableMessage for rule in ruleset when rule.regexToMatch.test logMessage
for entry in parsedLogEntries.all
humanReadableMessage = _getHumanReadableMessage entry.message
entry.humanReadableMessage = humanReadableMessage if humanReadableMessage?
return parsedLogEntries