Improve logging to better support unicode

Also add some files I forgot to add in a different feature branch.