-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// MemoryLogger.swift | ||
// RxNetworkKit | ||
// | ||
// Created by Loay Ashraf on 25/05/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
final class MemoryLogger { | ||
|
||
static let shared: MemoryLogger = .init() | ||
|
||
private init() { } | ||
|
||
func logLargeUploadFile(file: HTTPUploadRequestFile) { | ||
let logMessage = makeLogMessage(for: file) | ||
print(logMessage) | ||
} | ||
|
||
private func makeLogMessage(for file: HTTPUploadRequestFile) -> String { | ||
var logMessage = "" | ||
|
||
logMessage += "\n* * * * * * * * * * MEMORY WARNING * * * * * * * * * *\n" | ||
logMessage += "\nHolding a large file for upload in the device memory (> 10 MB),\nPerformance may be reduced if the available memory is low.\n" | ||
logMessage += "\nFile Details:\n" | ||
logMessage += "- Name: \(file.name)\n" | ||
logMessage += "- Type: \(file.mimeType.rawValue)\n" | ||
logMessage += "- Size: \(file.size.formattedSize)\n" | ||
logMessage += "\n* * * * * * * * * * * * * END * * * * * * * * * * * * *\n" | ||
|
||
return logMessage | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters