Logs misc. events with OSLog

* Discovering AltServers
* Clearing app cache
* Updating Friend Zone Patrons
This commit is contained in:
Riley Testut
2023-10-18 14:11:39 -05:00
committed by Magesh K
parent c19b541739
commit 2ccf01cf9c
3 changed files with 8 additions and 6 deletions

View File

@@ -109,12 +109,12 @@ private extension ClearAppCacheOperation
{
do
{
print("[ALTLog] Removing item from temporary directory:", fileURL.lastPathComponent)
Logger.main.debug("Removing item from temporary directory: \(fileURL.lastPathComponent, privacy: .public)")
try FileManager.default.removeItem(at: fileURL)
}
catch
{
print("[ALTLog] Failed to remove \(fileURL.lastPathComponent) from temporary directory.", error)
Logger.main.error("Failed to remove \(fileURL.lastPathComponent) from temporary directory. \(error.localizedDescription, privacy: .public)")
errors.append(error)
}
}
@@ -174,13 +174,13 @@ private extension ClearAppCacheOperation
if isDirectory && !installedAppBundleIDs.contains(bundleID) && !AppManager.shared.isActivelyManagingApp(withBundleID: bundleID)
{
print("[ALTLog] Removing backup directory for uninstalled app:", bundleID)
Logger.main.debug("Removing backup directory for uninstalled app: \(bundleID, privacy: .public)")
try FileManager.default.removeItem(at: backupDirectory)
}
}
catch
{
print("[ALTLog] Failed to remove app backup directory:", error)
Logger.main.error("Failed to remove app backup directory. \(error.localizedDescription, privacy: .public)")
errors.append(error)
}
}
@@ -198,7 +198,7 @@ private extension ClearAppCacheOperation
}
catch
{
print("[ALTLog] Failed to remove app backup directory:", error)
Logger.main.error("Failed to remove app backup directory. \(error.localizedDescription, privacy: .public)")
completion(.failure(error))
}
}

View File

@@ -87,10 +87,11 @@ final class UpdatePatronsOperation: ResultOperation<Void>
self.finish(.success(()))
print("Updated Friend Zone Patrons!")
Logger.main.notice("Updated Friend Zone Patrons! Refresh ID: \(response.refreshID, privacy: .public)")
}
catch
{
Logger.main.error("Failed to update Friend Zone Patrons. \(error.localizedDescription, privacy: .public)")
self.finish(.failure(error))
}
}

View File

@@ -12,6 +12,7 @@ public extension Logger
{
static let altstoreSubsystem = Bundle.main.bundleIdentifier!
static let main = Logger(subsystem: altstoreSubsystem, category: "Main")
static let sideload = Logger(subsystem: altstoreSubsystem, category: "Sideload")
static let altjit = Logger(subsystem: altstoreSubsystem, category: "AltJIT")