Module: LogParser
- Included in:
- TexLogParser
- Defined in:
- lib/log_parser/log_parser.rb,
lib/log_parser/buffer.rb,
lib/log_parser/logger.rb,
lib/log_parser/message.rb,
lib/log_parser/pattern.rb
Overview
Parses a log, extracting messages according to a set of Pattern.
Instances are single-use; create a new one for every log and parsing run.
Defined Under Namespace
Modules: Pattern, RegExpPattern Classes: Buffer, Logger, Message
Instance Attribute Summary collapse
-
#messages ⇒ Array<Message>
readonly
The messages this parser found in the given log.
-
#scope_changes_by_line ⇒ Hash<Integer, Array<String>>
readonly
The parser keeps a record of the scope changes it detects.
Instance Method Summary collapse
-
#parse ⇒ Array<Message>
Parses the given log lines and extracts all messages (of known form).
Instance Attribute Details
#messages ⇒ Array<Message> (readonly)
Returns the messages this parser found in the given log.
14 15 16 |
# File 'lib/log_parser/log_parser.rb', line 14 def @messages end |
#scope_changes_by_line ⇒ Hash<Integer, Array<String>> (readonly)
The parser keeps a record of the scope changes it detects.
Note: Only available in debug mode; see Logger.
The keys are line indices. The values are arrays of strings, with one string per scope change, in the same order as in the original line.
* Entering a new scope is denoted by
```
push filename
```
and
* leaving a scope by
```
pop filename
```
Note the extra space after `pop` here; it's there for quaint cosmetic reasons.
38 39 40 |
# File 'lib/log_parser/log_parser.rb', line 38 def scope_changes_by_line @scope_changes_by_line end |
Instance Method Details
#parse ⇒ Array<Message>
Parses the given log lines and extracts all messages (of known form).
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/log_parser/log_parser.rb', line 42 def parse skip_empty_lines until empty? parse_next_lines skip_empty_lines end # TODO: Remove duplicates? @messages end |