ws_log() reimplementation for newline character appending

Please review carefully.
Nope. It is used in another scope as well. (see line  106)