replace tab to space and add log function