Logging: Do not append to the DOM in every iteration but only once per call