Added some logic to logger