Fix errors in logging, also use better string formatting for logger