Fixed various bugs in logger and added formatting as I guessed it's supposed to be? please recheck