mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2025-12-23 17:04:25 +01:00
Swift notification plugin (#436)
* Add Swift notification plugin * Hash the metadata * Validate min sendable amount * Remove initializer as base class, UNNotificationServiceExtension, has no default initializer * Set the PaymentMethod * Handle PaymentDetails in SwapUpdated * Improve payment text
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import Foundation
|
||||
import os.log
|
||||
|
||||
#if DEBUG && true
|
||||
fileprivate var logger = OSLog(
|
||||
subsystem: Bundle.main.bundleIdentifier!,
|
||||
category: "ServiceLogger"
|
||||
)
|
||||
#else
|
||||
fileprivate var logger = OSLog.disabled
|
||||
#endif
|
||||
|
||||
open class ServiceLogger {
|
||||
var logStream: Logger?
|
||||
|
||||
init(logStream: Logger?) {
|
||||
self.logStream = logStream
|
||||
}
|
||||
|
||||
public func log(tag: String, line: String, level: String) {
|
||||
if let logger = logStream {
|
||||
logger.log(l: LogEntry(line: line, level: level))
|
||||
} else {
|
||||
switch(level) {
|
||||
case "ERROR":
|
||||
os_log("[%{public}@] %{public}@", log: logger, type: .error, tag, line)
|
||||
break
|
||||
case "INFO", "WARN":
|
||||
os_log("[%{public}@] %{public}@", log: logger, type: .info, tag, line)
|
||||
break
|
||||
case "TRACE":
|
||||
os_log("[%{public}@] %{public}@", log: logger, type: .debug, tag, line)
|
||||
break
|
||||
default:
|
||||
os_log("[%{public}@] %{public}@", log: logger, type: .default, tag, line)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user