Modifies code to make it more modular for test
Adds tests for log_generator