Merge pull request #23 from keeshux/sync-swifty-beaver
Sync with SwiftyBeaver queue
This commit is contained in:
commit
23ce387b69
|
@ -1 +1 @@
|
||||||
4.0
|
4.2
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
PODS:
|
PODS:
|
||||||
- OpenSSL-Apple (1.1.0h)
|
- OpenSSL-Apple (1.1.0h)
|
||||||
- SwiftyBeaver (1.6.0)
|
- SwiftyBeaver (1.6.1)
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- OpenSSL-Apple (~> 1.1.0h)
|
- OpenSSL-Apple (~> 1.1.0h)
|
||||||
|
@ -13,7 +13,7 @@ SPEC REPOS:
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
OpenSSL-Apple: cd153d705ef350eb834ae7ff5f21f792b51ed208
|
OpenSSL-Apple: cd153d705ef350eb834ae7ff5f21f792b51ed208
|
||||||
SwiftyBeaver: e45759613e50b522b0e6f53b1f0f14389b45ca34
|
SwiftyBeaver: ccfcdf85a04d429f1633f668650b0ce8020bda3a
|
||||||
|
|
||||||
PODFILE CHECKSUM: db783bdfb06f72df39d3c99df20aafdb51e0f7c6
|
PODFILE CHECKSUM: db783bdfb06f72df39d3c99df20aafdb51e0f7c6
|
||||||
|
|
||||||
|
|
|
@ -665,11 +665,13 @@
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
0E1108991F77B9E800A92462 = {
|
0E1108991F77B9E800A92462 = {
|
||||||
CreatedOnToolsVersion = 9.0;
|
CreatedOnToolsVersion = 9.0;
|
||||||
|
LastSwiftMigration = 1000;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
TestTargetID = 0E1108A81F77B9F900A92462;
|
TestTargetID = 0E1108A81F77B9F900A92462;
|
||||||
};
|
};
|
||||||
0E1108A81F77B9F900A92462 = {
|
0E1108A81F77B9F900A92462 = {
|
||||||
CreatedOnToolsVersion = 9.0;
|
CreatedOnToolsVersion = 9.0;
|
||||||
|
LastSwiftMigration = 1000;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
SystemCapabilities = {
|
SystemCapabilities = {
|
||||||
com.apple.ApplicationGroups.iOS = {
|
com.apple.ApplicationGroups.iOS = {
|
||||||
|
@ -682,6 +684,7 @@
|
||||||
};
|
};
|
||||||
0E17D7F81F730D9F009EE129 = {
|
0E17D7F81F730D9F009EE129 = {
|
||||||
CreatedOnToolsVersion = 9.0;
|
CreatedOnToolsVersion = 9.0;
|
||||||
|
LastSwiftMigration = 1000;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
};
|
};
|
||||||
0E3251C41F95770D00C108D9 = {
|
0E3251C41F95770D00C108D9 = {
|
||||||
|
@ -1011,6 +1014,7 @@
|
||||||
INFOPLIST_FILE = TunnelKitTests/Info.plist;
|
INFOPLIST_FILE = TunnelKitTests/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_VERSION = 4.2;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TunnelKitHost.app/TunnelKitHost";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TunnelKitHost.app/TunnelKitHost";
|
||||||
};
|
};
|
||||||
|
@ -1025,6 +1029,7 @@
|
||||||
INFOPLIST_FILE = TunnelKitTests/Info.plist;
|
INFOPLIST_FILE = TunnelKitTests/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_VERSION = 4.2;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TunnelKitHost.app/TunnelKitHost";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TunnelKitHost.app/TunnelKitHost";
|
||||||
};
|
};
|
||||||
|
@ -1042,6 +1047,7 @@
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.algoritmico.ios.TunnelKitHost;
|
PRODUCT_BUNDLE_IDENTIFIER = com.algoritmico.ios.TunnelKitHost;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_VERSION = 4.2;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
|
@ -1058,6 +1064,7 @@
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.algoritmico.ios.TunnelKitHost;
|
PRODUCT_BUNDLE_IDENTIFIER = com.algoritmico.ios.TunnelKitHost;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_VERSION = 4.2;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
@ -1120,7 +1127,7 @@
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
SWIFT_VERSION = 4.0;
|
SWIFT_VERSION = 4.2;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
VERSION_INFO_PREFIX = "";
|
VERSION_INFO_PREFIX = "";
|
||||||
};
|
};
|
||||||
|
@ -1176,7 +1183,7 @@
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||||
SWIFT_VERSION = 4.0;
|
SWIFT_VERSION = 4.2;
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
VERSION_INFO_PREFIX = "";
|
VERSION_INFO_PREFIX = "";
|
||||||
|
|
|
@ -39,8 +39,6 @@ import Foundation
|
||||||
import SwiftyBeaver
|
import SwiftyBeaver
|
||||||
|
|
||||||
class MemoryDestination: BaseDestination, CustomStringConvertible {
|
class MemoryDestination: BaseDestination, CustomStringConvertible {
|
||||||
private let queue = DispatchQueue(label: "MemoryDestination")
|
|
||||||
|
|
||||||
private var buffer: [String] = []
|
private var buffer: [String] = []
|
||||||
|
|
||||||
var maxLines: Int?
|
var maxLines: Int?
|
||||||
|
@ -51,36 +49,35 @@ class MemoryDestination: BaseDestination, CustomStringConvertible {
|
||||||
}
|
}
|
||||||
|
|
||||||
func start(with existing: [String]) {
|
func start(with existing: [String]) {
|
||||||
queue.sync {
|
execute(synchronously: true) {
|
||||||
buffer = existing
|
self.buffer = existing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func flush(to: UserDefaults, with key: String) {
|
func flush(to: UserDefaults, with key: String) {
|
||||||
queue.sync {
|
execute(synchronously: true) {
|
||||||
to.set(buffer, forKey: key)
|
to.set(self.buffer, forKey: key)
|
||||||
}
|
}
|
||||||
to.synchronize()
|
to.synchronize()
|
||||||
}
|
}
|
||||||
|
|
||||||
var description: String {
|
var description: String {
|
||||||
return queue.sync {
|
return executeSynchronously {
|
||||||
return buffer.joined(separator: "\n")
|
return self.buffer.joined(separator: "\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: BaseDestination
|
// MARK: BaseDestination
|
||||||
|
|
||||||
|
// XXX: executed in SwiftyBeaver queue. DO NOT invoke execute* here (sync in sync would crash otherwise)
|
||||||
override func send(_ level: SwiftyBeaver.Level, msg: String, thread: String, file: String, function: String, line: Int, context: Any?) -> String? {
|
override func send(_ level: SwiftyBeaver.Level, msg: String, thread: String, file: String, function: String, line: Int, context: Any?) -> String? {
|
||||||
guard let message = super.send(level, msg: msg, thread: thread, file: file, function: function, line: line) else {
|
guard let message = super.send(level, msg: msg, thread: thread, file: file, function: function, line: line) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
queue.sync {
|
buffer.append(message)
|
||||||
buffer.append(message)
|
if let maxLines = maxLines {
|
||||||
if let maxLines = maxLines {
|
while buffer.count > maxLines {
|
||||||
while (buffer.count > maxLines) {
|
buffer.removeFirst()
|
||||||
buffer.removeFirst()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return message
|
return message
|
||||||
|
|
|
@ -43,7 +43,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
|
|
||||||
|
|
||||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||||
// Override point for customization after application launch.
|
// Override point for customization after application launch.
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue