added log function to auto scroll the log