A simple log parser
bundle install
bundle rspec # run the tests
ruby parser.rb webserver.log # output data from websever.log
The DataAnalyser
is the public facing class that is responsible for taking the log file and returning data.
The responsibility of parsing the log and formatting it was passed to the LogParser
and
Formatter
respectively.
Unit testing is done using RSpec and test coverage is handled by SimpleCov. Test coverage is 100% and can be viewed here.
RuboCop was used for linting.
- Add integration test
LogParser
expects a certain format of input and is therefor not very extendable.LogParser
splits the data based on an assumed format. We should validate that the line is in the expected format,/page 123.123.123.123
, and stop processing if a line is not as expected.- Add additional file formats that the
DataAnalyser
accepts.