Skip to content

Commit be0aaaf

Browse files
committed
Add commented-out function for permanent log storage
Added a commented-out implementation of addLogPermanentStore and a helper function formatLogResult to Logging.swift. These functions provide logic for storing log records permanently, including handling of snapshot tasks and updating or creating log entries.
1 parent 676fc54 commit be0aaaf

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

RsyncUI/Model/Loggdata/Logging.swift

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,40 @@ final class Logging {
154154
}
155155
}
156156
}
157+
158+
/*
159+
160+
func addLogPermanentStore(scheduleRecords: [TypeLogData]) {
161+
scheduleRecords.forEach { logData in
162+
let hiddenID = logData.0
163+
let stats = logData.1
164+
let currentDate = Date()
165+
let dateString = currentDate.en_string_from_date()
166+
167+
guard let config = getConfig(hiddenID: hiddenID) else { return }
168+
169+
let annotatedResult = formatLogResult(stats: stats, config: config)
170+
171+
// Try updating existing record first, then create new if needed
172+
let wasInserted = addLogExisting(hiddenID: hiddenID,
173+
result: annotatedResult,
174+
date: dateString)
175+
|| addLogNew(hiddenID: hiddenID,
176+
result: annotatedResult,
177+
date: dateString)
178+
179+
// Optional: Handle insertion failure if needed
180+
// if !wasInserted { /* log error */ }
181+
}
182+
183+
WriteLogRecordsJSON(localeProfile, logRecords)
184+
}
185+
186+
private func formatLogResult(stats: String, config: Config) -> String {
187+
guard config.task == SharedReference.shared.snapshot else { return stats }
188+
189+
let snapshotNumber = (config.snapshotNum ?? 1) - 1
190+
return "(\(snapshotNumber)) \(stats)"
191+
}
192+
193+
*/

0 commit comments

Comments
 (0)