Instead, let's go with something that'll separate messages that need to be separated in a given period of time and skip all this unnecessary background processing.
To do this, we'll make a message mode system that groups messages of the same category and separates ones of different category. Basically, if the previous message is the same type of message as the one being sent, do not separate it. If it's not though, add a little linebreak to separate it.
This can be used in games where you use the same output for everything; in my case, MUDs certainly do this, in general. With a lot of text coming at you all the time, it's good to visually see when messages are related or not. And the existence of a separating line will point that out pretty well.
My personal usage will look something like this. If a user is set to echo, clear the message mode so that the next message sent after the echo isn't separated from it. This'll make it so if the user's CLIENT echoes, we don't end up with a stupid linebreak after their echo, since that's handled locally for them. We don't decide when their client does that.