ws_log() reimplementation for newline character appending

Please review carefully.