Javascript console.log on the same line

I need to print results on the same line of code without using .innerHTML(“”).
I could do it by overwriting original console.log function. This code bellow does it. However, this code prints every console.log text to next line.

(function () {
if (!console) {
    console = {};
}
var old = console.log;
var logger = document.getElementById('log');
console.log = function (message) {
    if (typeof message == 'object') {
        logger.innerHTML += (String(message)) + '<br>';
    } else {
        logger.innerHTML += message + '<br>';
    }
}
})();

Do you know how could I modify this to print text of console.log to next line only if user writes command console.log(“textn”);, and if it’s written console.log(“text”); the default should be to write inline text. (like function printf in C for example)