Fix logging highlighting, visibility, and newlines

Avoid logging plain text messages using appendHtml(), otherwise newlines
will be stripped, and tags interpreted.  Also ensure that the cursor is
at the end of the log text to ensure the latest log statement is always
visible, and the wrong highlighting isn't inherited when inserting plain
text.