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

17 lines
550 B
CoffeeScript
Raw Normal View History

define [
"libs/latex-log-parser"
2016-06-16 10:29:00 -04:00
"ide/human-readable-logs/HumanReadableLogsRules"
], (LogParser, ruleset) ->
parse : (rawLog, options) ->
parsedLogEntries = LogParser.parse(rawLog, options)
2016-06-16 10:29:00 -04:00
_getRule = (logMessage) ->
return rule for rule in ruleset when rule.regexToMatch.test logMessage
for entry in parsedLogEntries.all
{ humanReadableHint, extraInfoURL } = _getRule entry.message
entry.humanReadableHint = humanReadableHint if humanReadableHint?
entry.extraInfoURL = extraInfoURL if extraInfoURL?
2016-06-16 10:29:00 -04:00
return parsedLogEntries