Optimize logger

I noticed a couple of simple optimizations about logging.