Checking if format is not nil before logging