fixed logger so it can handle multi-line and whitespace