ws_log() reimplementation for newline character appending

Please review carefully.
Yes, but you can use `pred_len` there, too.
In your implementation, _both_ vars have the same value. It doesn't make sense to have both of them.