ws_log() reimplementation for newline character appending

Please review carefully.
Does this even compile?