adding Flush() function to flush log buffer