private static void HandleFile(string filePath) { ReadLogs readLog = new ReadLogs(); IEnumerable <string> ipsAndCounts = readLog.ReadWrite(filePath + "access.log"); WriteToCSV writeIPsandCount = new WriteToCSV(); writeIPsandCount.ExportToCSV(ipsAndCounts, filePath + "report.csv"); }
// Formats the logs to a CSV row format and saves them. Calls the CSV headers generation beforehand. // If a parameter doesn't have a value for a given row, uses the given value given previously (see // UpdateHeadersAndDefaults). private void SaveToCSV(string label, bool clear) { if (!enableCSVSave) { return; } if (logsList.TryGetValue(label, out LogStore logStore)) { WriteToCSV writeToCsv = new WriteToCSV(logStore, savePath, filePrefix, fileExtension); writeToCsv.WriteAll(() => { logStore.TargetsSaved[TargetType.CSV] = true; SaveCallback(logStore, clear); }); } else { Debug.LogWarning("Trying to save to CSV " + label + " collection but it doesn't exist."); } }