Skip to content

Commit e0e47a7

Browse files
authored
fix: Add additional diagnostic logging (#177)
1 parent eaf6d16 commit e0e47a7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/Amplitude/Storages/PersistentStorage.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class PersistentStorage: Storage {
9191
return readV1File(content: content!)
9292
}
9393
} catch {
94+
diagonostics.addErrorLog(error.localizedDescription)
9495
logger?.error(message: error.localizedDescription)
9596
}
9697
return content
@@ -101,6 +102,7 @@ class PersistentStorage: Storage {
101102
do {
102103
try fileManager.removeItem(atPath: eventBlock.path)
103104
} catch {
105+
diagonostics.addErrorLog(error.localizedDescription)
104106
logger?.error(message: error.localizedDescription)
105107
}
106108
}
@@ -117,6 +119,7 @@ class PersistentStorage: Storage {
117119
do {
118120
try fileManager.removeItem(atPath: eventBlock.path)
119121
} catch {
122+
diagonostics.addErrorLog(error.localizedDescription)
120123
logger?.error(message: error.localizedDescription)
121124
}
122125
}
@@ -349,6 +352,7 @@ extension PersistentStorage {
349352
}
350353
try outputStream?.write("\(jsonString)\(PersistentStorage.DELMITER)")
351354
} catch {
355+
diagonostics.addErrorLog(error.localizedDescription)
352356
logger?.error(message: error.localizedDescription)
353357
}
354358
finish(file: storeFile)
@@ -359,6 +363,7 @@ extension PersistentStorage {
359363
outputStream = try OutputFileStream(fileURL: file)
360364
try outputStream?.create()
361365
} catch {
366+
diagonostics.addErrorLog(error.localizedDescription)
362367
logger?.error(message: error.localizedDescription)
363368
}
364369
}

0 commit comments

Comments
 (0)