make logtime into a function to be more readable