Class: HerokuLogParser::Parser
- Inherits:
-
Object
- Object
- HerokuLogParser::Parser
- Includes:
- Singleton
- Defined in:
- lib/heroku_log_parser/parser.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.parse(text) ⇒ Object
24 25 26 |
# File 'lib/heroku_log_parser/parser.rb', line 24 def parse(text) instance.parse(text) end |
Instance Method Details
#parse(text) ⇒ Object
19 20 21 |
# File 'lib/heroku_log_parser/parser.rb', line 19 def parse(text) parse_line(text) end |
#parse_line(line) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/heroku_log_parser/parser.rb', line 7 def parse_line(line) matches = line.match(/^(.*?)\s(.*)\[(.*)\]\:\s(.*)$/) JSON.generate({ timestamp: matches[1], source: matches[2], process: matches[3], message: matches[4] }) end |