Refine code to add current time in log