Log rotation

Code review needed + some small rspec tests.