Class: LogParser

LogParser

LogParser can be used to transform raw log text to LogEvents The LogParser class per se is only responsible for dividing the raw text into different executions according to the supplied delimiter. It then creates one ExecutionParser for each execution to which to task for parsing is then delegated.

The raw log potentially contains text for multiple executions. Delimiters demarcate where one execution's text ends and another begins. Labels can be given to executions by specifying a "trace" capture group within the delimiter regex. (So the label text must be part of the delimiter). This label can later be used to identify an execution. If an execution's text is not preceeded by a delimiter, it is given the empty string as its label.

Constructor

new LogParser(rawString, delimiter, regexp)

Constructs a LogParser to parse the provided raw log text.
Parameters:
Name Type Description
rawString String the raw log text
delimiter NamedRegExp a regex that specifies the delimiter. Anything that matches the regex will be treated as a delimiter. A delimiter acts to separate different executions.
regexp NamedRegExp A regex that specifies the log parser. The parser must contain the named capture groups "clock", "event", and "host" representing the vector clock, the event string, and the host respectively.
Source:

Methods

getLabels() → {Array.<String>}

Gets all of the labels of the executions. The ordering of labels in the returned array is guarenteed to be the same as the order in which they are encountered in the raw log text
Source:
Returns:
An array of all the labels.
Type
Array.<String>

getLogEvents(label) → {Array.<LogEvent>}

Returns the LogEvents parsed by this. The ordering of LogEvents in the returned array is guaranteed to be the same as the order in which they were encountered in the raw log text
Parameters:
Name Type Description
label String The label of the execution you want to get log events from.
Source:
Returns:
An array of LogEvents
Type
Array.<LogEvent>