CollectLogs function