mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 02:51:11 +00:00
Improve logging
This commit is contained in:
1 parent
0df17c1bc7
commit
4c95be694f
5 files changed
+23
-12
No files matched your search
@@ -513,9 +513,11 @@ class InboundNearbyConnection: NearbyConnection {
|
||||
#endif
|
||||
filesToBeReceived[id]!.progress = progress
|
||||
filesToBeReceived[id]!.created = true
|
||||
|
||||
log("[InboundNearbyConnection \(self.id)] Accepted file with size \(file.meta.size)")
|
||||
}
|
||||
|
||||
let totalBytes = filesToBeReceived.values.reduce(0) { $0 + $1.meta.size }
|
||||
let gigabytes = Double(totalBytes) / 1_000_000_000
|
||||
log("[InboundNearbyConnection \(self.id)] Accepted \(filesToBeReceived.count) file(s) with size \(totalBytes) bytes (\(gigabytes) GB)")
|
||||
|
||||
var frame = Sharing_Nearby_Frame()
|
||||
frame.version = .v1
|
||||
|
||||
@@ -207,8 +207,7 @@ class NearbyConnection {
|
||||
log("[NearbyConnection \(self.id)] Connection closed by peer during receiveFrameAsync(length:)")
|
||||
|
||||
if let content = content, !content.isEmpty {
|
||||
log("[NearbyConnection \(self.id)] Connection closed by peer during receiveFrameAsync(length:), but trying to process the frame anyway. Frame length: \(content.count)")
|
||||
self.processReceivedFrame(frameData: content)
|
||||
log("[NearbyConnection \(self.id)] Connection closed by peer during receiveFrameAsync(length:), and frame not empty. Frame length: \(content.count)")
|
||||
}
|
||||
else {
|
||||
log("[NearbyConnection \(self.id)] Connection closed by peer during receiveFrameAsync(length:), but no content received anymore (\(String(describing: content))).")
|
||||
@@ -424,7 +423,10 @@ class NearbyConnection {
|
||||
}
|
||||
else if offlineFrame.hasV1, offlineFrame.v1.hasType, case .keepAlive = offlineFrame.v1.type {
|
||||
|
||||
log("[NearbyConnection \(self.id)] Sent keep-alive, \(self.bytesTransferred) bytes sent")
|
||||
let bytesTransferred = self.bytesTransferred
|
||||
let gigabytesTransferred = Double(bytesTransferred) / 1_000_000_000
|
||||
|
||||
log("[NearbyConnection \(self.id)] Sent keep-alive, \(self.bytesTransferred) bytes (\(gigabytesTransferred) GB) sent")
|
||||
sendKeepAlive(ack: true)
|
||||
} else {
|
||||
|
||||
|
||||
@@ -112,6 +112,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
||||
|
||||
let queue2 = DispatchQueue(label: "NetworkConnectionMonitor")
|
||||
hasConnectionMonitor.start(queue: queue2)
|
||||
|
||||
log("Application did finish launching")
|
||||
}
|
||||
|
||||
|
||||
@@ -147,10 +149,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
||||
func application(_ application: NSApplication, open urls: [URL]) {
|
||||
for url in urls {
|
||||
if url.scheme == "quickdrop", url.host == "sendLog" {
|
||||
sendLoggingString() // this time it runs in the main app
|
||||
sendLoggingString()
|
||||
}
|
||||
|
||||
|
||||
if url.scheme == "quickdrop", url.host == "openLog", let url = LogManager.sharedInstance.logFileURL {
|
||||
log("Opening log file: \(url)")
|
||||
// open folder containing the log file
|
||||
|
||||
@@ -7157,6 +7157,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Reset UD" : {
|
||||
|
||||
},
|
||||
"SaveFilesLocation" : {
|
||||
"extractionState" : "manual",
|
||||
|
||||
@@ -148,12 +148,15 @@ func sendLoggingString() {
|
||||
if let url = LogManager.sharedInstance.logFileURL {
|
||||
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown"
|
||||
log("Sending logging string with file URL: \(url)")
|
||||
log("Currently running apps: \(NSWorkspace.shared.runningApplications.map { $0.localizedName ?? "Unknown" })")
|
||||
|
||||
sendEmailWithAttachment(
|
||||
fileURL: url,
|
||||
recipients: ["quickdrop@leonboettger.com"],
|
||||
subject: "QuickDrop \(appVersion) - \(getDeviceAndSystem())"
|
||||
)
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3, execute: {
|
||||
sendEmailWithAttachment(
|
||||
fileURL: url,
|
||||
recipients: ["quickdrop@leonboettger.com"],
|
||||
subject: "QuickDrop \(appVersion) - \(getDeviceAndSystem())"
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user