Adding unit test and completed code for logger

correct the names and spaces also adding try except for file