diff --git a/.gitignore b/.gitignore index 7900175..a6aa878 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ #### joe made this: http://goel.io/joe - +Pods/ #####=== OSX ===##### .DS_Store .AppleDouble diff --git a/.travis.yml b/.travis.yml index 2c984b8..c1ce9c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,15 @@ language: objective-c -osx_image: xcode8.2 +osx_image: xcode8.3 cache: cocoapods env: global: - - IOS_SDK=iphonesimulator9.3 + - IOS_SDK=iphonesimulator10.3 - WORKSPACE=YapTaskQueue.xcworkspace - POD_WORKSPACE=YapTaskQueueSpecTest/YapTaskQueueSpecTest.xcworkspace - IOS_FRAMEWORK_SCHEME=YapTaskQueue - POD_IOS_FRAMEWORK_SCHEME=YapTaskQueueSpecTest matrix: - - DESTINATION="OS=8.1,name=iPhone 4S" POD_LINT="YES" - - DESTINATION="OS=8.2,name=iPhone 5" POD_LINT="NO" - - DESTINATION="OS=8.3,name=iPhone 5S" POD_LINT="NO" - - DESTINATION="OS=8.4,name=iPhone 6" POD_LINT="NO" - - DESTINATION="OS=9.0,name=iPhone 6" POD_LINT="NO" - - DESTINATION="OS=9.1,name=iPhone 6 Plus" POD_LINT="NO" - - DESTINATION="OS=9.2,name=iPhone 6S" POD_LINT="NO" - - DESTINATION="OS=9.3,name=iPhone 6S Plus" POD_LINT="NO" + - DESTINATION="OS=10.3,name=iPhone 7" POD_LINT="NO" script: - pod update - pod update --project-directory=YapTaskQueueSpecTest/ diff --git a/Podfile b/Podfile index 49e26f4..e487c44 100644 --- a/Podfile +++ b/Podfile @@ -5,12 +5,12 @@ use_frameworks! target 'YapTaskQueue' do -pod 'YapDatabase', '~> 2.9' +pod 'YapDatabase', '~> 3.0' end target 'YapTaskQueueTests' do -pod 'YapDatabase', '~> 2.9' +pod 'YapDatabase', '~> 3.0' end diff --git a/Podfile.lock b/Podfile.lock index 2fb1a0d..e9d8ec7 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,72 +1,78 @@ PODS: - - CocoaLumberjack (2.4.0): - - CocoaLumberjack/Default (= 2.4.0) - - CocoaLumberjack/Extensions (= 2.4.0) - - CocoaLumberjack/Core (2.4.0) - - CocoaLumberjack/Default (2.4.0): - - CocoaLumberjack/Core - - CocoaLumberjack/Extensions (2.4.0): + - CocoaLumberjack (3.2.0): + - CocoaLumberjack/Default (= 3.2.0) + - CocoaLumberjack/Extensions (= 3.2.0) + - CocoaLumberjack/Default (3.2.0) + - CocoaLumberjack/Extensions (3.2.0): - CocoaLumberjack/Default - - Reachability (3.2) - - YapDatabase (2.9.2): - - YapDatabase/Standard (= 2.9.2) - - YapDatabase/Standard (2.9.2): - - YapDatabase/Standard/Core (= 2.9.2) - - YapDatabase/Standard/Extensions (= 2.9.2) - - YapDatabase/Standard/Core (2.9.2): - - CocoaLumberjack (~> 2) - - YapDatabase/Standard/Extensions (2.9.2): + - YapDatabase (3.0): + - YapDatabase/Standard (= 3.0) + - YapDatabase/Standard (3.0): + - YapDatabase/Standard/Core (= 3.0) + - YapDatabase/Standard/Extensions (= 3.0) + - YapDatabase/Standard/Core (3.0): + - CocoaLumberjack + - YapDatabase/Standard/Extensions (3.0): - YapDatabase/Standard/Core - - YapDatabase/Standard/Extensions/ActionManager (= 2.9.2) - - YapDatabase/Standard/Extensions/CloudKit (= 2.9.2) - - YapDatabase/Standard/Extensions/ConnectionProxy (= 2.9.2) - - YapDatabase/Standard/Extensions/CrossProcessNotification (= 2.9.2) - - YapDatabase/Standard/Extensions/FilteredViews (= 2.9.2) - - YapDatabase/Standard/Extensions/FullTextSearch (= 2.9.2) - - YapDatabase/Standard/Extensions/Hooks (= 2.9.2) - - YapDatabase/Standard/Extensions/Relationships (= 2.9.2) - - YapDatabase/Standard/Extensions/RTreeIndex (= 2.9.2) - - YapDatabase/Standard/Extensions/SearchResults (= 2.9.2) - - YapDatabase/Standard/Extensions/SecondaryIndex (= 2.9.2) - - YapDatabase/Standard/Extensions/Views (= 2.9.2) - - YapDatabase/Standard/Extensions/ActionManager (2.9.2): - - Reachability (~> 3) + - YapDatabase/Standard/Extensions/ActionManager (= 3.0) + - YapDatabase/Standard/Extensions/AutoView (= 3.0) + - YapDatabase/Standard/Extensions/CloudCore (= 3.0) + - YapDatabase/Standard/Extensions/CloudKit (= 3.0) + - YapDatabase/Standard/Extensions/ConnectionProxy (= 3.0) + - YapDatabase/Standard/Extensions/CrossProcessNotification (= 3.0) + - YapDatabase/Standard/Extensions/FilteredView (= 3.0) + - YapDatabase/Standard/Extensions/FullTextSearch (= 3.0) + - YapDatabase/Standard/Extensions/Hooks (= 3.0) + - YapDatabase/Standard/Extensions/ManualView (= 3.0) + - YapDatabase/Standard/Extensions/Relationships (= 3.0) + - YapDatabase/Standard/Extensions/RTreeIndex (= 3.0) + - YapDatabase/Standard/Extensions/SearchResultsView (= 3.0) + - YapDatabase/Standard/Extensions/SecondaryIndex (= 3.0) + - YapDatabase/Standard/Extensions/View (= 3.0) + - YapDatabase/Standard/Extensions/ActionManager (3.0): - YapDatabase/Standard/Core - - YapDatabase/Standard/Extensions/Views - - YapDatabase/Standard/Extensions/CloudKit (2.9.2): + - YapDatabase/Standard/Extensions/AutoView + - YapDatabase/Standard/Extensions/AutoView (3.0): - YapDatabase/Standard/Core - - YapDatabase/Standard/Extensions/ConnectionProxy (2.9.2): + - YapDatabase/Standard/Extensions/View + - YapDatabase/Standard/Extensions/CloudCore (3.0): - YapDatabase/Standard/Core - - YapDatabase/Standard/Extensions/CrossProcessNotification (2.9.2): + - YapDatabase/Standard/Extensions/CloudKit (3.0): - YapDatabase/Standard/Core - - YapDatabase/Standard/Extensions/FilteredViews (2.9.2): + - YapDatabase/Standard/Extensions/ConnectionProxy (3.0): - YapDatabase/Standard/Core - - YapDatabase/Standard/Extensions/Views - - YapDatabase/Standard/Extensions/FullTextSearch (2.9.2): + - YapDatabase/Standard/Extensions/CrossProcessNotification (3.0): - YapDatabase/Standard/Core - - YapDatabase/Standard/Extensions/Hooks (2.9.2): + - YapDatabase/Standard/Extensions/FilteredView (3.0): - YapDatabase/Standard/Core - - YapDatabase/Standard/Extensions/Relationships (2.9.2): + - YapDatabase/Standard/Extensions/View + - YapDatabase/Standard/Extensions/FullTextSearch (3.0): - YapDatabase/Standard/Core - - YapDatabase/Standard/Extensions/RTreeIndex (2.9.2): + - YapDatabase/Standard/Extensions/Hooks (3.0): - YapDatabase/Standard/Core - - YapDatabase/Standard/Extensions/SearchResults (2.9.2): + - YapDatabase/Standard/Extensions/ManualView (3.0): - YapDatabase/Standard/Core + - YapDatabase/Standard/Extensions/View + - YapDatabase/Standard/Extensions/Relationships (3.0): + - YapDatabase/Standard/Core + - YapDatabase/Standard/Extensions/RTreeIndex (3.0): + - YapDatabase/Standard/Core + - YapDatabase/Standard/Extensions/SearchResultsView (3.0): + - YapDatabase/Standard/Core + - YapDatabase/Standard/Extensions/AutoView - YapDatabase/Standard/Extensions/FullTextSearch - - YapDatabase/Standard/Extensions/Views - - YapDatabase/Standard/Extensions/SecondaryIndex (2.9.2): + - YapDatabase/Standard/Extensions/SecondaryIndex (3.0): - YapDatabase/Standard/Core - - YapDatabase/Standard/Extensions/Views (2.9.2): + - YapDatabase/Standard/Extensions/View (3.0): - YapDatabase/Standard/Core DEPENDENCIES: - - YapDatabase (~> 2.9) + - YapDatabase (~> 3.0) SPEC CHECKSUMS: - CocoaLumberjack: aa9dcab71bdf9eaf2a63bbd9ddc87863efe45457 - Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 - YapDatabase: b1e43555a34a5298e23a045be96817a5ef0da58f + CocoaLumberjack: 9b4aed7073d242f29cc2f62068d995faf67f703a + YapDatabase: 0cef6c79948169c924ae325d430ffcfa8a5231c2 -PODFILE CHECKSUM: 042c51895cdf8fa702f19ecfb82faea5c6fbc5c5 +PODFILE CHECKSUM: f9b255e9bd651b16e75a81f0cb8f6a4ca4f5ca7f -COCOAPODS: 1.2.0 +COCOAPODS: 1.2.1 diff --git a/Pods/CocoaLumberjack/Classes/CocoaLumberjack.h b/Pods/CocoaLumberjack/Classes/CocoaLumberjack.h deleted file mode 100644 index fe5202f..0000000 --- a/Pods/CocoaLumberjack/Classes/CocoaLumberjack.h +++ /dev/null @@ -1,81 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2010-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -/** - * Welcome to CocoaLumberjack! - * - * The project page has a wealth of documentation if you have any questions. - * https://github.com/CocoaLumberjack/CocoaLumberjack - * - * If you're new to the project you may wish to read "Getting Started" at: - * Documentation/GettingStarted.md - * - * Otherwise, here is a quick refresher. - * There are three steps to using the macros: - * - * Step 1: - * Import the header in your implementation or prefix file: - * - * #import - * - * Step 2: - * Define your logging level in your implementation file: - * - * // Log levels: off, error, warn, info, verbose - * static const DDLogLevel ddLogLevel = DDLogLevelVerbose; - * - * Step 2 [3rd party frameworks]: - * - * Define your LOG_LEVEL_DEF to a different variable/function than ddLogLevel: - * - * // #undef LOG_LEVEL_DEF // Undefine first only if needed - * #define LOG_LEVEL_DEF myLibLogLevel - * - * Define your logging level in your implementation file: - * - * // Log levels: off, error, warn, info, verbose - * static const DDLogLevel myLibLogLevel = DDLogLevelVerbose; - * - * Step 3: - * Replace your NSLog statements with DDLog statements according to the severity of the message. - * - * NSLog(@"Fatal error, no dohickey found!"); -> DDLogError(@"Fatal error, no dohickey found!"); - * - * DDLog works exactly the same as NSLog. - * This means you can pass it multiple variables just like NSLog. - **/ - -#import - -// Disable legacy macros -#ifndef DD_LEGACY_MACROS - #define DD_LEGACY_MACROS 0 -#endif - -// Core -#import "DDLog.h" - -// Main macros -#import "DDLogMacros.h" -#import "DDAssertMacros.h" - -// Capture ASL -#import "DDASLLogCapture.h" - -// Loggers -#import "DDTTYLogger.h" -#import "DDASLLogger.h" -#import "DDFileLogger.h" - diff --git a/Pods/CocoaLumberjack/Classes/CocoaLumberjack.swift b/Pods/CocoaLumberjack/Classes/CocoaLumberjack.swift deleted file mode 100644 index a4bbf06..0000000 --- a/Pods/CocoaLumberjack/Classes/CocoaLumberjack.swift +++ /dev/null @@ -1,102 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2014-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -import Foundation - -extension DDLogFlag { - public static func fromLogLevel(logLevel: DDLogLevel) -> DDLogFlag { - return DDLogFlag(rawValue: logLevel.rawValue) - } - - public init(_ logLevel: DDLogLevel) { - self = DDLogFlag(rawValue: logLevel.rawValue) - } - - ///returns the log level, or the lowest equivalant. - public func toLogLevel() -> DDLogLevel { - if let ourValid = DDLogLevel(rawValue: self.rawValue) { - return ourValid - } else { - let logFlag:DDLogFlag = self - - if logFlag.contains(.Verbose) { - return .Verbose - } else if logFlag.contains(.Debug) { - return .Debug - } else if logFlag.contains(.Info) { - return .Info - } else if logFlag.contains(.Warning) { - return .Warning - } else if logFlag.contains(.Error) { - return .Error - } else { - return .Off - } - } - } -} - -public var defaultDebugLevel = DDLogLevel.Verbose - -public func resetDefaultDebugLevel() { - defaultDebugLevel = DDLogLevel.Verbose -} - -@available(*, deprecated, message="Use one of the DDLog*() functions if appropriate or call _DDLogMessage()") -public func SwiftLogMacro(isAsynchronous: Bool, level: DDLogLevel, flag flg: DDLogFlag, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: AnyObject? = nil, @autoclosure string: () -> String, ddlog: DDLog = DDLog.sharedInstance()) { - _DDLogMessage(string, level: level, flag: flg, context: context, file: file, function: function, line: line, tag: tag, asynchronous: isAsynchronous, ddlog: ddlog) -} - -public func _DDLogMessage(@autoclosure message: () -> String, level: DDLogLevel, flag: DDLogFlag, context: Int, file: StaticString, function: StaticString, line: UInt, tag: AnyObject?, asynchronous: Bool, ddlog: DDLog) { - if level.rawValue & flag.rawValue != 0 { - // Tell the DDLogMessage constructor to copy the C strings that get passed to it. - let logMessage = DDLogMessage(message: message(), level: level, flag: flag, context: context, file: file.stringValue, function: function.stringValue, line: line, tag: tag, options: [.CopyFile, .CopyFunction], timestamp: nil) - ddlog.log(asynchronous, message: logMessage) - } -} - -public func DDLogDebug(@autoclosure message: () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: AnyObject? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance()) { - _DDLogMessage(message, level: level, flag: .Debug, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) -} - -public func DDLogInfo(@autoclosure message: () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: AnyObject? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance()) { - _DDLogMessage(message, level: level, flag: .Info, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) -} - -public func DDLogWarn(@autoclosure message: () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: AnyObject? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance()) { - _DDLogMessage(message, level: level, flag: .Warning, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) -} - -public func DDLogVerbose(@autoclosure message: () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: AnyObject? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance()) { - _DDLogMessage(message, level: level, flag: .Verbose, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) -} - -public func DDLogError(@autoclosure message: () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: AnyObject? = nil, asynchronous async: Bool = false, ddlog: DDLog = DDLog.sharedInstance()) { - _DDLogMessage(message, level: level, flag: .Error, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) -} - -/// Returns a String of the current filename, without full path or extension. -/// -/// Analogous to the C preprocessor macro `THIS_FILE`. -public func CurrentFileName(fileName: StaticString = #file) -> String { - var str = fileName.stringValue - if let idx = str.rangeOfString("/", options: .BackwardsSearch)?.endIndex { - str = str.substringFromIndex(idx) - } - if let idx = str.rangeOfString(".", options: .BackwardsSearch)?.startIndex { - str = str.substringToIndex(idx) - } - return str -} diff --git a/Pods/CocoaLumberjack/Classes/DDASLLogCapture.h b/Pods/CocoaLumberjack/Classes/DDASLLogCapture.h deleted file mode 100644 index e3d0f02..0000000 --- a/Pods/CocoaLumberjack/Classes/DDASLLogCapture.h +++ /dev/null @@ -1,48 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2010-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -#import "DDASLLogger.h" - -@protocol DDLogger; - -/** - * This class provides the ability to capture the ASL (Apple System Logs) - */ -@interface DDASLLogCapture : NSObject - -/** - * Start capturing logs - */ -+ (void)start; - -/** - * Stop capturing logs - */ -+ (void)stop; - -/** - * Returns the current capture level. - * @note Default log level: DDLogLevelVerbose (i.e. capture all ASL messages). - */ -+ (DDLogLevel)captureLevel; - -/** - * Set the capture level - * - * @param level new level - */ -+ (void)setCaptureLevel:(DDLogLevel)level; - -@end diff --git a/Pods/CocoaLumberjack/Classes/DDASLLogCapture.m b/Pods/CocoaLumberjack/Classes/DDASLLogCapture.m deleted file mode 100644 index 4341d6d..0000000 --- a/Pods/CocoaLumberjack/Classes/DDASLLogCapture.m +++ /dev/null @@ -1,230 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2010-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -#import "DDASLLogCapture.h" - -// Disable legacy macros -#ifndef DD_LEGACY_MACROS - #define DD_LEGACY_MACROS 0 -#endif - -#import "DDLog.h" - -#include -#include -#include -#include - -static BOOL _cancel = YES; -static DDLogLevel _captureLevel = DDLogLevelVerbose; - -#ifdef __IPHONE_8_0 - #define DDASL_IOS_PIVOT_VERSION __IPHONE_8_0 -#endif -#ifdef __MAC_10_10 - #define DDASL_OSX_PIVOT_VERSION __MAC_10_10 -#endif - -@implementation DDASLLogCapture - -static aslmsg (*dd_asl_next)(aslresponse obj); -static void (*dd_asl_release)(aslresponse obj); - -+ (void)initialize -{ - #if (defined(DDASL_IOS_PIVOT_VERSION) && __IPHONE_OS_VERSION_MAX_ALLOWED >= DDASL_IOS_PIVOT_VERSION) || (defined(DDASL_OSX_PIVOT_VERSION) && __MAC_OS_X_VERSION_MAX_ALLOWED >= DDASL_OSX_PIVOT_VERSION) - #if __IPHONE_OS_VERSION_MIN_REQUIRED < DDASL_IOS_PIVOT_VERSION || __MAC_OS_X_VERSION_MIN_REQUIRED < DDASL_OSX_PIVOT_VERSION - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - // Building on falsely advertised SDK, targeting deprecated API - dd_asl_next = &aslresponse_next; - dd_asl_release = &aslresponse_free; - #pragma GCC diagnostic pop - #else - // Building on lastest, correct SDK, targeting latest API - dd_asl_next = &asl_next; - dd_asl_release = &asl_release; - #endif - #else - // Building on old SDKs, targeting deprecated API - dd_asl_next = &aslresponse_next; - dd_asl_release = &aslresponse_free; - #endif -} - -+ (void)start { - // Ignore subsequent calls - if (!_cancel) { - return; - } - - _cancel = NO; - - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) { - [self captureAslLogs]; - }); -} - -+ (void)stop { - _cancel = YES; -} - -+ (DDLogLevel)captureLevel { - return _captureLevel; -} - -+ (void)setCaptureLevel:(DDLogLevel)level { - _captureLevel = level; -} - -#pragma mark - Private methods - -+ (void)configureAslQuery:(aslmsg)query { - const char param[] = "7"; // ASL_LEVEL_DEBUG, which is everything. We'll rely on regular DDlog log level to filter - - asl_set_query(query, ASL_KEY_LEVEL, param, ASL_QUERY_OP_LESS_EQUAL | ASL_QUERY_OP_NUMERIC); - - // Don't retrieve logs from our own DDASLLogger - asl_set_query(query, kDDASLKeyDDLog, kDDASLDDLogValue, ASL_QUERY_OP_NOT_EQUAL); - -#if !TARGET_OS_IPHONE || TARGET_SIMULATOR - int processId = [[NSProcessInfo processInfo] processIdentifier]; - char pid[16]; - sprintf(pid, "%d", processId); - asl_set_query(query, ASL_KEY_PID, pid, ASL_QUERY_OP_EQUAL | ASL_QUERY_OP_NUMERIC); -#endif -} - -+ (void)aslMessageReceived:(aslmsg)msg { - const char* messageCString = asl_get( msg, ASL_KEY_MSG ); - if ( messageCString == NULL ) - return; - - int flag; - BOOL async; - - const char* levelCString = asl_get(msg, ASL_KEY_LEVEL); - switch (levelCString? atoi(levelCString) : 0) { - // By default all NSLog's with a ASL_LEVEL_WARNING level - case ASL_LEVEL_EMERG : - case ASL_LEVEL_ALERT : - case ASL_LEVEL_CRIT : flag = DDLogFlagError; async = NO; break; - case ASL_LEVEL_ERR : flag = DDLogFlagWarning; async = YES; break; - case ASL_LEVEL_WARNING : flag = DDLogFlagInfo; async = YES; break; - case ASL_LEVEL_NOTICE : flag = DDLogFlagDebug; async = YES; break; - case ASL_LEVEL_INFO : - case ASL_LEVEL_DEBUG : - default : flag = DDLogFlagVerbose; async = YES; break; - } - - if (!(_captureLevel & flag)) { - return; - } - - // NSString * sender = [NSString stringWithCString:asl_get(msg, ASL_KEY_SENDER) encoding:NSUTF8StringEncoding]; - NSString *message = @(messageCString); - - const char* secondsCString = asl_get( msg, ASL_KEY_TIME ); - const char* nanoCString = asl_get( msg, ASL_KEY_TIME_NSEC ); - NSTimeInterval seconds = secondsCString ? strtod(secondsCString, NULL) : [NSDate timeIntervalSinceReferenceDate] - NSTimeIntervalSince1970; - double nanoSeconds = nanoCString? strtod(nanoCString, NULL) : 0; - NSTimeInterval totalSeconds = seconds + (nanoSeconds / 1e9); - - NSDate *timeStamp = [NSDate dateWithTimeIntervalSince1970:totalSeconds]; - - DDLogMessage *logMessage = [[DDLogMessage alloc]initWithMessage:message - level:_captureLevel - flag:flag - context:0 - file:@"DDASLLogCapture" - function:0 - line:0 - tag:nil - options:0 - timestamp:timeStamp]; - - [DDLog log:async message:logMessage]; -} - -+ (void)captureAslLogs { - @autoreleasepool - { - /* - We use ASL_KEY_MSG_ID to see each message once, but there's no - obvious way to get the "next" ID. To bootstrap the process, we'll - search by timestamp until we've seen a message. - */ - - struct timeval timeval = { - .tv_sec = 0 - }; - gettimeofday(&timeval, NULL); - unsigned long long startTime = timeval.tv_sec; - __block unsigned long long lastSeenID = 0; - - /* - syslogd posts kNotifyASLDBUpdate (com.apple.system.logger.message) - through the notify API when it saves messages to the ASL database. - There is some coalescing - currently it is sent at most twice per - second - but there is no documented guarantee about this. In any - case, there may be multiple messages per notification. - - Notify notifications don't carry any payload, so we need to search - for the messages. - */ - int notifyToken = 0; // Can be used to unregister with notify_cancel(). - notify_register_dispatch(kNotifyASLDBUpdate, ¬ifyToken, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(int token) - { - // At least one message has been posted; build a search query. - @autoreleasepool - { - aslmsg query = asl_new(ASL_TYPE_QUERY); - char stringValue[64]; - - if (lastSeenID > 0) { - snprintf(stringValue, sizeof stringValue, "%llu", lastSeenID); - asl_set_query(query, ASL_KEY_MSG_ID, stringValue, ASL_QUERY_OP_GREATER | ASL_QUERY_OP_NUMERIC); - } else { - snprintf(stringValue, sizeof stringValue, "%llu", startTime); - asl_set_query(query, ASL_KEY_TIME, stringValue, ASL_QUERY_OP_GREATER_EQUAL | ASL_QUERY_OP_NUMERIC); - } - - [self configureAslQuery:query]; - - // Iterate over new messages. - aslmsg msg; - aslresponse response = asl_search(NULL, query); - - while ((msg = dd_asl_next(response))) - { - [self aslMessageReceived:msg]; - - // Keep track of which messages we've seen. - lastSeenID = atoll(asl_get(msg, ASL_KEY_MSG_ID)); - } - dd_asl_release(response); - asl_free(query); - - if (_cancel) { - notify_cancel(token); - return; - } - - } - }); - } -} - -@end diff --git a/Pods/CocoaLumberjack/Classes/DDASLLogger.h b/Pods/CocoaLumberjack/Classes/DDASLLogger.h deleted file mode 100644 index 6f6fce1..0000000 --- a/Pods/CocoaLumberjack/Classes/DDASLLogger.h +++ /dev/null @@ -1,58 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2010-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -#import - -// Disable legacy macros -#ifndef DD_LEGACY_MACROS - #define DD_LEGACY_MACROS 0 -#endif - -#import "DDLog.h" - -// Custom key set on messages sent to ASL -extern const char* const kDDASLKeyDDLog; - -// Value set for kDDASLKeyDDLog -extern const char* const kDDASLDDLogValue; - -/** - * This class provides a logger for the Apple System Log facility. - * - * As described in the "Getting Started" page, - * the traditional NSLog() function directs its output to two places: - * - * - Apple System Log - * - StdErr (if stderr is a TTY) so log statements show up in Xcode console - * - * To duplicate NSLog() functionality you can simply add this logger and a tty logger. - * However, if you instead choose to use file logging (for faster performance), - * you may choose to use a file logger and a tty logger. - **/ -@interface DDASLLogger : DDAbstractLogger - -/** - * Singleton method - * - * @return the shared instance - */ -+ (instancetype)sharedInstance; - -// Inherited from DDAbstractLogger - -// - (id )logFormatter; -// - (void)setLogFormatter:(id )formatter; - -@end diff --git a/Pods/CocoaLumberjack/Classes/DDASLLogger.m b/Pods/CocoaLumberjack/Classes/DDASLLogger.m deleted file mode 100644 index d399d6a..0000000 --- a/Pods/CocoaLumberjack/Classes/DDASLLogger.m +++ /dev/null @@ -1,121 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2010-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -#import "DDASLLogger.h" -#import - -#if !__has_feature(objc_arc) -#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). -#endif - -const char* const kDDASLKeyDDLog = "DDLog"; - -const char* const kDDASLDDLogValue = "1"; - -static DDASLLogger *sharedInstance; - -@interface DDASLLogger () { - aslclient _client; -} - -@end - - -@implementation DDASLLogger - -+ (instancetype)sharedInstance { - static dispatch_once_t DDASLLoggerOnceToken; - - dispatch_once(&DDASLLoggerOnceToken, ^{ - sharedInstance = [[[self class] alloc] init]; - }); - - return sharedInstance; -} - -- (instancetype)init { - if (sharedInstance != nil) { - return nil; - } - - if ((self = [super init])) { - // A default asl client is provided for the main thread, - // but background threads need to create their own client. - - _client = asl_open(NULL, "com.apple.console", 0); - } - - return self; -} - -- (void)logMessage:(DDLogMessage *)logMessage { - // Skip captured log messages - if ([logMessage->_fileName isEqualToString:@"DDASLLogCapture"]) { - return; - } - - NSString * message = _logFormatter ? [_logFormatter formatLogMessage:logMessage] : logMessage->_message; - - if (logMessage) { - const char *msg = [message UTF8String]; - - size_t aslLogLevel; - switch (logMessage->_flag) { - // Note: By default ASL will filter anything above level 5 (Notice). - // So our mappings shouldn't go above that level. - case DDLogFlagError : aslLogLevel = ASL_LEVEL_CRIT; break; - case DDLogFlagWarning : aslLogLevel = ASL_LEVEL_ERR; break; - case DDLogFlagInfo : aslLogLevel = ASL_LEVEL_WARNING; break; // Regular NSLog's level - case DDLogFlagDebug : - case DDLogFlagVerbose : - default : aslLogLevel = ASL_LEVEL_NOTICE; break; - } - - static char const *const level_strings[] = { "0", "1", "2", "3", "4", "5", "6", "7" }; - - // NSLog uses the current euid to set the ASL_KEY_READ_UID. - uid_t const readUID = geteuid(); - - char readUIDString[16]; -#ifndef NS_BLOCK_ASSERTIONS - int l = snprintf(readUIDString, sizeof(readUIDString), "%d", readUID); -#else - snprintf(readUIDString, sizeof(readUIDString), "%d", readUID); -#endif - - NSAssert(l < sizeof(readUIDString), - @"Formatted euid is too long."); - NSAssert(aslLogLevel < (sizeof(level_strings) / sizeof(level_strings[0])), - @"Unhandled ASL log level."); - - aslmsg m = asl_new(ASL_TYPE_MSG); - if (m != NULL) { - if (asl_set(m, ASL_KEY_LEVEL, level_strings[aslLogLevel]) == 0 && - asl_set(m, ASL_KEY_MSG, msg) == 0 && - asl_set(m, ASL_KEY_READ_UID, readUIDString) == 0 && - asl_set(m, kDDASLKeyDDLog, kDDASLDDLogValue) == 0) { - asl_send(_client, m); - } - asl_free(m); - } - //TODO handle asl_* failures non-silently? - } -} - -- (NSString *)loggerName { - return @"cocoa.lumberjack.aslLogger"; -} - -@end diff --git a/Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.h b/Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.h deleted file mode 100644 index 208bb22..0000000 --- a/Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.h +++ /dev/null @@ -1,123 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2010-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -// Disable legacy macros -#ifndef DD_LEGACY_MACROS - #define DD_LEGACY_MACROS 0 -#endif - -#import "DDLog.h" - -/** - * This class provides an abstract implementation of a database logger. - * - * That is, it provides the base implementation for a database logger to build atop of. - * All that is needed for a concrete database logger is to extend this class - * and override the methods in the implementation file that are prefixed with "db_". - **/ -@interface DDAbstractDatabaseLogger : DDAbstractLogger { - -@protected - NSUInteger _saveThreshold; - NSTimeInterval _saveInterval; - NSTimeInterval _maxAge; - NSTimeInterval _deleteInterval; - BOOL _deleteOnEverySave; - - BOOL _saveTimerSuspended; - NSUInteger _unsavedCount; - dispatch_time_t _unsavedTime; - dispatch_source_t _saveTimer; - dispatch_time_t _lastDeleteTime; - dispatch_source_t _deleteTimer; -} - -/** - * Specifies how often to save the data to disk. - * Since saving is an expensive operation (disk io) it is not done after every log statement. - * These properties allow you to configure how/when the logger saves to disk. - * - * A save is done when either (whichever happens first): - * - * - The number of unsaved log entries reaches saveThreshold - * - The amount of time since the oldest unsaved log entry was created reaches saveInterval - * - * You can optionally disable the saveThreshold by setting it to zero. - * If you disable the saveThreshold you are entirely dependent on the saveInterval. - * - * You can optionally disable the saveInterval by setting it to zero (or a negative value). - * If you disable the saveInterval you are entirely dependent on the saveThreshold. - * - * It's not wise to disable both saveThreshold and saveInterval. - * - * The default saveThreshold is 500. - * The default saveInterval is 60 seconds. - **/ -@property (assign, readwrite) NSUInteger saveThreshold; - -/** - * See the description for the `saveThreshold` property - */ -@property (assign, readwrite) NSTimeInterval saveInterval; - -/** - * It is likely you don't want the log entries to persist forever. - * Doing so would allow the database to grow infinitely large over time. - * - * The maxAge property provides a way to specify how old a log statement can get - * before it should get deleted from the database. - * - * The deleteInterval specifies how often to sweep for old log entries. - * Since deleting is an expensive operation (disk io) is is done on a fixed interval. - * - * An alternative to the deleteInterval is the deleteOnEverySave option. - * This specifies that old log entries should be deleted during every save operation. - * - * You can optionally disable the maxAge by setting it to zero (or a negative value). - * If you disable the maxAge then old log statements are not deleted. - * - * You can optionally disable the deleteInterval by setting it to zero (or a negative value). - * - * If you disable both deleteInterval and deleteOnEverySave then old log statements are not deleted. - * - * It's not wise to enable both deleteInterval and deleteOnEverySave. - * - * The default maxAge is 7 days. - * The default deleteInterval is 5 minutes. - * The default deleteOnEverySave is NO. - **/ -@property (assign, readwrite) NSTimeInterval maxAge; - -/** - * See the description for the `maxAge` property - */ -@property (assign, readwrite) NSTimeInterval deleteInterval; - -/** - * See the description for the `maxAge` property - */ -@property (assign, readwrite) BOOL deleteOnEverySave; - -/** - * Forces a save of any pending log entries (flushes log entries to disk). - **/ -- (void)savePendingLogEntries; - -/** - * Removes any log entries that are older than maxAge. - **/ -- (void)deleteOldLogEntries; - -@end diff --git a/Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.m b/Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.m deleted file mode 100644 index 0200f7c..0000000 --- a/Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.m +++ /dev/null @@ -1,660 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2010-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -#import "DDAbstractDatabaseLogger.h" -#import - - -#if !__has_feature(objc_arc) -#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). -#endif - -@interface DDAbstractDatabaseLogger () - -- (void)destroySaveTimer; -- (void)destroyDeleteTimer; - -@end - -#pragma mark - - -@implementation DDAbstractDatabaseLogger - -- (instancetype)init { - if ((self = [super init])) { - _saveThreshold = 500; - _saveInterval = 60; // 60 seconds - _maxAge = (60 * 60 * 24 * 7); // 7 days - _deleteInterval = (60 * 5); // 5 minutes - } - - return self; -} - -- (void)dealloc { - [self destroySaveTimer]; - [self destroyDeleteTimer]; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#pragma mark Override Me -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -- (BOOL)db_log:(DDLogMessage *)logMessage { - // Override me and add your implementation. - // - // Return YES if an item was added to the buffer. - // Return NO if the logMessage was ignored. - - return NO; -} - -- (void)db_save { - // Override me and add your implementation. -} - -- (void)db_delete { - // Override me and add your implementation. -} - -- (void)db_saveAndDelete { - // Override me and add your implementation. -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#pragma mark Private API -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -- (void)performSaveAndSuspendSaveTimer { - if (_unsavedCount > 0) { - if (_deleteOnEverySave) { - [self db_saveAndDelete]; - } else { - [self db_save]; - } - } - - _unsavedCount = 0; - _unsavedTime = 0; - - if (_saveTimer && !_saveTimerSuspended) { - dispatch_suspend(_saveTimer); - _saveTimerSuspended = YES; - } -} - -- (void)performDelete { - if (_maxAge > 0.0) { - [self db_delete]; - - _lastDeleteTime = dispatch_time(DISPATCH_TIME_NOW, 0); - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#pragma mark Timers -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -- (void)destroySaveTimer { - if (_saveTimer) { - dispatch_source_cancel(_saveTimer); - - if (_saveTimerSuspended) { - // Must resume a timer before releasing it (or it will crash) - dispatch_resume(_saveTimer); - _saveTimerSuspended = NO; - } - - #if !OS_OBJECT_USE_OBJC - dispatch_release(_saveTimer); - #endif - _saveTimer = NULL; - } -} - -- (void)updateAndResumeSaveTimer { - if ((_saveTimer != NULL) && (_saveInterval > 0.0) && (_unsavedTime > 0.0)) { - uint64_t interval = (uint64_t)(_saveInterval * NSEC_PER_SEC); - dispatch_time_t startTime = dispatch_time(_unsavedTime, interval); - - dispatch_source_set_timer(_saveTimer, startTime, interval, 1.0); - - if (_saveTimerSuspended) { - dispatch_resume(_saveTimer); - _saveTimerSuspended = NO; - } - } -} - -- (void)createSuspendedSaveTimer { - if ((_saveTimer == NULL) && (_saveInterval > 0.0)) { - _saveTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, self.loggerQueue); - - dispatch_source_set_event_handler(_saveTimer, ^{ @autoreleasepool { - [self performSaveAndSuspendSaveTimer]; - } }); - - _saveTimerSuspended = YES; - } -} - -- (void)destroyDeleteTimer { - if (_deleteTimer) { - dispatch_source_cancel(_deleteTimer); - #if !OS_OBJECT_USE_OBJC - dispatch_release(_deleteTimer); - #endif - _deleteTimer = NULL; - } -} - -- (void)updateDeleteTimer { - if ((_deleteTimer != NULL) && (_deleteInterval > 0.0) && (_maxAge > 0.0)) { - uint64_t interval = (uint64_t)(_deleteInterval * NSEC_PER_SEC); - dispatch_time_t startTime; - - if (_lastDeleteTime > 0) { - startTime = dispatch_time(_lastDeleteTime, interval); - } else { - startTime = dispatch_time(DISPATCH_TIME_NOW, interval); - } - - dispatch_source_set_timer(_deleteTimer, startTime, interval, 1.0); - } -} - -- (void)createAndStartDeleteTimer { - if ((_deleteTimer == NULL) && (_deleteInterval > 0.0) && (_maxAge > 0.0)) { - _deleteTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, self.loggerQueue); - - if (_deleteTimer != NULL) { - dispatch_source_set_event_handler(_deleteTimer, ^{ @autoreleasepool { - [self performDelete]; - } }); - - [self updateDeleteTimer]; - - if (_deleteTimer != NULL) { - dispatch_resume(_deleteTimer); - } - } - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#pragma mark Configuration -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -- (NSUInteger)saveThreshold { - // The design of this method is taken from the DDAbstractLogger implementation. - // For extensive documentation please refer to the DDAbstractLogger implementation. - - // Note: The internal implementation MUST access the colorsEnabled variable directly, - // This method is designed explicitly for external access. - // - // Using "self." syntax to go through this method will cause immediate deadlock. - // This is the intended result. Fix it by accessing the ivar directly. - // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. - - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax."); - - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - - __block NSUInteger result; - - dispatch_sync(globalLoggingQueue, ^{ - dispatch_sync(self.loggerQueue, ^{ - result = _saveThreshold; - }); - }); - - return result; -} - -- (void)setSaveThreshold:(NSUInteger)threshold { - dispatch_block_t block = ^{ - @autoreleasepool { - if (_saveThreshold != threshold) { - _saveThreshold = threshold; - - // Since the saveThreshold has changed, - // we check to see if the current unsavedCount has surpassed the new threshold. - // - // If it has, we immediately save the log. - - if ((_unsavedCount >= _saveThreshold) && (_saveThreshold > 0)) { - [self performSaveAndSuspendSaveTimer]; - } - } - } - }; - - // The design of the setter logic below is taken from the DDAbstractLogger implementation. - // For documentation please refer to the DDAbstractLogger implementation. - - if ([self isOnInternalLoggerQueue]) { - block(); - } else { - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - - dispatch_async(globalLoggingQueue, ^{ - dispatch_async(self.loggerQueue, block); - }); - } -} - -- (NSTimeInterval)saveInterval { - // The design of this method is taken from the DDAbstractLogger implementation. - // For extensive documentation please refer to the DDAbstractLogger implementation. - - // Note: The internal implementation MUST access the colorsEnabled variable directly, - // This method is designed explicitly for external access. - // - // Using "self." syntax to go through this method will cause immediate deadlock. - // This is the intended result. Fix it by accessing the ivar directly. - // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. - - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax."); - - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - - __block NSTimeInterval result; - - dispatch_sync(globalLoggingQueue, ^{ - dispatch_sync(self.loggerQueue, ^{ - result = _saveInterval; - }); - }); - - return result; -} - -- (void)setSaveInterval:(NSTimeInterval)interval { - dispatch_block_t block = ^{ - @autoreleasepool { - // C99 recommended floating point comparison macro - // Read: isLessThanOrGreaterThan(floatA, floatB) - - if (/* saveInterval != interval */ islessgreater(_saveInterval, interval)) { - _saveInterval = interval; - - // There are several cases we need to handle here. - // - // 1. If the saveInterval was previously enabled and it just got disabled, - // then we need to stop the saveTimer. (And we might as well release it.) - // - // 2. If the saveInterval was previously disabled and it just got enabled, - // then we need to setup the saveTimer. (Plus we might need to do an immediate save.) - // - // 3. If the saveInterval increased, then we need to reset the timer so that it fires at the later date. - // - // 4. If the saveInterval decreased, then we need to reset the timer so that it fires at an earlier date. - // (Plus we might need to do an immediate save.) - - if (_saveInterval > 0.0) { - if (_saveTimer == NULL) { - // Handles #2 - // - // Since the saveTimer uses the unsavedTime to calculate it's first fireDate, - // if a save is needed the timer will fire immediately. - - [self createSuspendedSaveTimer]; - [self updateAndResumeSaveTimer]; - } else { - // Handles #3 - // Handles #4 - // - // Since the saveTimer uses the unsavedTime to calculate it's first fireDate, - // if a save is needed the timer will fire immediately. - - [self updateAndResumeSaveTimer]; - } - } else if (_saveTimer) { - // Handles #1 - - [self destroySaveTimer]; - } - } - } - }; - - // The design of the setter logic below is taken from the DDAbstractLogger implementation. - // For documentation please refer to the DDAbstractLogger implementation. - - if ([self isOnInternalLoggerQueue]) { - block(); - } else { - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - - dispatch_async(globalLoggingQueue, ^{ - dispatch_async(self.loggerQueue, block); - }); - } -} - -- (NSTimeInterval)maxAge { - // The design of this method is taken from the DDAbstractLogger implementation. - // For extensive documentation please refer to the DDAbstractLogger implementation. - - // Note: The internal implementation MUST access the colorsEnabled variable directly, - // This method is designed explicitly for external access. - // - // Using "self." syntax to go through this method will cause immediate deadlock. - // This is the intended result. Fix it by accessing the ivar directly. - // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. - - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax."); - - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - - __block NSTimeInterval result; - - dispatch_sync(globalLoggingQueue, ^{ - dispatch_sync(self.loggerQueue, ^{ - result = _maxAge; - }); - }); - - return result; -} - -- (void)setMaxAge:(NSTimeInterval)interval { - dispatch_block_t block = ^{ - @autoreleasepool { - // C99 recommended floating point comparison macro - // Read: isLessThanOrGreaterThan(floatA, floatB) - - if (/* maxAge != interval */ islessgreater(_maxAge, interval)) { - NSTimeInterval oldMaxAge = _maxAge; - NSTimeInterval newMaxAge = interval; - - _maxAge = interval; - - // There are several cases we need to handle here. - // - // 1. If the maxAge was previously enabled and it just got disabled, - // then we need to stop the deleteTimer. (And we might as well release it.) - // - // 2. If the maxAge was previously disabled and it just got enabled, - // then we need to setup the deleteTimer. (Plus we might need to do an immediate delete.) - // - // 3. If the maxAge was increased, - // then we don't need to do anything. - // - // 4. If the maxAge was decreased, - // then we should do an immediate delete. - - BOOL shouldDeleteNow = NO; - - if (oldMaxAge > 0.0) { - if (newMaxAge <= 0.0) { - // Handles #1 - - [self destroyDeleteTimer]; - } else if (oldMaxAge > newMaxAge) { - // Handles #4 - shouldDeleteNow = YES; - } - } else if (newMaxAge > 0.0) { - // Handles #2 - shouldDeleteNow = YES; - } - - if (shouldDeleteNow) { - [self performDelete]; - - if (_deleteTimer) { - [self updateDeleteTimer]; - } else { - [self createAndStartDeleteTimer]; - } - } - } - } - }; - - // The design of the setter logic below is taken from the DDAbstractLogger implementation. - // For documentation please refer to the DDAbstractLogger implementation. - - if ([self isOnInternalLoggerQueue]) { - block(); - } else { - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - - dispatch_async(globalLoggingQueue, ^{ - dispatch_async(self.loggerQueue, block); - }); - } -} - -- (NSTimeInterval)deleteInterval { - // The design of this method is taken from the DDAbstractLogger implementation. - // For extensive documentation please refer to the DDAbstractLogger implementation. - - // Note: The internal implementation MUST access the colorsEnabled variable directly, - // This method is designed explicitly for external access. - // - // Using "self." syntax to go through this method will cause immediate deadlock. - // This is the intended result. Fix it by accessing the ivar directly. - // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. - - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax."); - - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - - __block NSTimeInterval result; - - dispatch_sync(globalLoggingQueue, ^{ - dispatch_sync(self.loggerQueue, ^{ - result = _deleteInterval; - }); - }); - - return result; -} - -- (void)setDeleteInterval:(NSTimeInterval)interval { - dispatch_block_t block = ^{ - @autoreleasepool { - // C99 recommended floating point comparison macro - // Read: isLessThanOrGreaterThan(floatA, floatB) - - if (/* deleteInterval != interval */ islessgreater(_deleteInterval, interval)) { - _deleteInterval = interval; - - // There are several cases we need to handle here. - // - // 1. If the deleteInterval was previously enabled and it just got disabled, - // then we need to stop the deleteTimer. (And we might as well release it.) - // - // 2. If the deleteInterval was previously disabled and it just got enabled, - // then we need to setup the deleteTimer. (Plus we might need to do an immediate delete.) - // - // 3. If the deleteInterval increased, then we need to reset the timer so that it fires at the later date. - // - // 4. If the deleteInterval decreased, then we need to reset the timer so that it fires at an earlier date. - // (Plus we might need to do an immediate delete.) - - if (_deleteInterval > 0.0) { - if (_deleteTimer == NULL) { - // Handles #2 - // - // Since the deleteTimer uses the lastDeleteTime to calculate it's first fireDate, - // if a delete is needed the timer will fire immediately. - - [self createAndStartDeleteTimer]; - } else { - // Handles #3 - // Handles #4 - // - // Since the deleteTimer uses the lastDeleteTime to calculate it's first fireDate, - // if a save is needed the timer will fire immediately. - - [self updateDeleteTimer]; - } - } else if (_deleteTimer) { - // Handles #1 - - [self destroyDeleteTimer]; - } - } - } - }; - - // The design of the setter logic below is taken from the DDAbstractLogger implementation. - // For documentation please refer to the DDAbstractLogger implementation. - - if ([self isOnInternalLoggerQueue]) { - block(); - } else { - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - - dispatch_async(globalLoggingQueue, ^{ - dispatch_async(self.loggerQueue, block); - }); - } -} - -- (BOOL)deleteOnEverySave { - // The design of this method is taken from the DDAbstractLogger implementation. - // For extensive documentation please refer to the DDAbstractLogger implementation. - - // Note: The internal implementation MUST access the colorsEnabled variable directly, - // This method is designed explicitly for external access. - // - // Using "self." syntax to go through this method will cause immediate deadlock. - // This is the intended result. Fix it by accessing the ivar directly. - // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. - - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax."); - - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - - __block BOOL result; - - dispatch_sync(globalLoggingQueue, ^{ - dispatch_sync(self.loggerQueue, ^{ - result = _deleteOnEverySave; - }); - }); - - return result; -} - -- (void)setDeleteOnEverySave:(BOOL)flag { - dispatch_block_t block = ^{ - _deleteOnEverySave = flag; - }; - - // The design of the setter logic below is taken from the DDAbstractLogger implementation. - // For documentation please refer to the DDAbstractLogger implementation. - - if ([self isOnInternalLoggerQueue]) { - block(); - } else { - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - - dispatch_async(globalLoggingQueue, ^{ - dispatch_async(self.loggerQueue, block); - }); - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#pragma mark Public API -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -- (void)savePendingLogEntries { - dispatch_block_t block = ^{ - @autoreleasepool { - [self performSaveAndSuspendSaveTimer]; - } - }; - - if ([self isOnInternalLoggerQueue]) { - block(); - } else { - dispatch_async(self.loggerQueue, block); - } -} - -- (void)deleteOldLogEntries { - dispatch_block_t block = ^{ - @autoreleasepool { - [self performDelete]; - } - }; - - if ([self isOnInternalLoggerQueue]) { - block(); - } else { - dispatch_async(self.loggerQueue, block); - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#pragma mark DDLogger -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -- (void)didAddLogger { - // If you override me be sure to invoke [super didAddLogger]; - - [self createSuspendedSaveTimer]; - - [self createAndStartDeleteTimer]; -} - -- (void)willRemoveLogger { - // If you override me be sure to invoke [super willRemoveLogger]; - - [self performSaveAndSuspendSaveTimer]; - - [self destroySaveTimer]; - [self destroyDeleteTimer]; -} - -- (void)logMessage:(DDLogMessage *)logMessage { - if ([self db_log:logMessage]) { - BOOL firstUnsavedEntry = (++_unsavedCount == 1); - - if ((_unsavedCount >= _saveThreshold) && (_saveThreshold > 0)) { - [self performSaveAndSuspendSaveTimer]; - } else if (firstUnsavedEntry) { - _unsavedTime = dispatch_time(DISPATCH_TIME_NOW, 0); - [self updateAndResumeSaveTimer]; - } - } -} - -- (void)flush { - // This method is invoked by DDLog's flushLog method. - // - // It is called automatically when the application quits, - // or if the developer invokes DDLog's flushLog method prior to crashing or something. - - [self performSaveAndSuspendSaveTimer]; -} - -@end diff --git a/Pods/CocoaLumberjack/Classes/DDAssertMacros.h b/Pods/CocoaLumberjack/Classes/DDAssertMacros.h deleted file mode 100644 index 7678a9c..0000000 --- a/Pods/CocoaLumberjack/Classes/DDAssertMacros.h +++ /dev/null @@ -1,26 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2010-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -/** - * NSAsset replacement that will output a log message even when assertions are disabled. - **/ -#define DDAssert(condition, frmt, ...) \ - if (!(condition)) { \ - NSString *description = [NSString stringWithFormat:frmt, ## __VA_ARGS__]; \ - DDLogError(@"%@", description); \ - NSAssert(NO, description); \ - } -#define DDAssertCondition(condition) DDAssert(condition, @"Condition not satisfied: %s", #condition) - diff --git a/Pods/CocoaLumberjack/Classes/DDFileLogger.h b/Pods/CocoaLumberjack/Classes/DDFileLogger.h deleted file mode 100644 index cf5048d..0000000 --- a/Pods/CocoaLumberjack/Classes/DDFileLogger.h +++ /dev/null @@ -1,490 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2010-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -// Disable legacy macros -#ifndef DD_LEGACY_MACROS - #define DD_LEGACY_MACROS 0 -#endif - -#import "DDLog.h" - -@class DDLogFileInfo; - -/** - * This class provides a logger to write log statements to a file. - **/ - - -// Default configuration and safety/sanity values. -// -// maximumFileSize -> kDDDefaultLogMaxFileSize -// rollingFrequency -> kDDDefaultLogRollingFrequency -// maximumNumberOfLogFiles -> kDDDefaultLogMaxNumLogFiles -// logFilesDiskQuota -> kDDDefaultLogFilesDiskQuota -// -// You should carefully consider the proper configuration values for your application. - -extern unsigned long long const kDDDefaultLogMaxFileSize; -extern NSTimeInterval const kDDDefaultLogRollingFrequency; -extern NSUInteger const kDDDefaultLogMaxNumLogFiles; -extern unsigned long long const kDDDefaultLogFilesDiskQuota; - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#pragma mark - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * The LogFileManager protocol is designed to allow you to control all aspects of your log files. - * - * The primary purpose of this is to allow you to do something with the log files after they have been rolled. - * Perhaps you want to compress them to save disk space. - * Perhaps you want to upload them to an FTP server. - * Perhaps you want to run some analytics on the file. - * - * A default LogFileManager is, of course, provided. - * The default LogFileManager simply deletes old log files according to the maximumNumberOfLogFiles property. - * - * This protocol provides various methods to fetch the list of log files. - * - * There are two variants: sorted and unsorted. - * If sorting is not necessary, the unsorted variant is obviously faster. - * The sorted variant will return an array sorted by when the log files were created, - * with the most recently created log file at index 0, and the oldest log file at the end of the array. - * - * You can fetch only the log file paths (full path including name), log file names (name only), - * or an array of `DDLogFileInfo` objects. - * The `DDLogFileInfo` class is documented below, and provides a handy wrapper that - * gives you easy access to various file attributes such as the creation date or the file size. - */ -@protocol DDLogFileManager -@required - -// Public properties - -/** - * The maximum number of archived log files to keep on disk. - * For example, if this property is set to 3, - * then the LogFileManager will only keep 3 archived log files (plus the current active log file) on disk. - * Once the active log file is rolled/archived, then the oldest of the existing 3 rolled/archived log files is deleted. - * - * You may optionally disable this option by setting it to zero. - **/ -@property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles; - -/** - * The maximum space that logs can take. On rolling logfile all old logfiles that exceed logFilesDiskQuota will - * be deleted. - * - * You may optionally disable this option by setting it to zero. - **/ -@property (readwrite, assign, atomic) unsigned long long logFilesDiskQuota; - -// Public methods - -/** - * Returns the logs directory (path) - */ -- (NSString *)logsDirectory; - -/** - * Returns an array of `NSString` objects, - * each of which is the filePath to an existing log file on disk. - **/ -- (NSArray *)unsortedLogFilePaths; - -/** - * Returns an array of `NSString` objects, - * each of which is the fileName of an existing log file on disk. - **/ -- (NSArray *)unsortedLogFileNames; - -/** - * Returns an array of `DDLogFileInfo` objects, - * each representing an existing log file on disk, - * and containing important information about the log file such as it's modification date and size. - **/ -- (NSArray *)unsortedLogFileInfos; - -/** - * Just like the `unsortedLogFilePaths` method, but sorts the array. - * The items in the array are sorted by creation date. - * The first item in the array will be the most recently created log file. - **/ -- (NSArray *)sortedLogFilePaths; - -/** - * Just like the `unsortedLogFileNames` method, but sorts the array. - * The items in the array are sorted by creation date. - * The first item in the array will be the most recently created log file. - **/ -- (NSArray *)sortedLogFileNames; - -/** - * Just like the `unsortedLogFileInfos` method, but sorts the array. - * The items in the array are sorted by creation date. - * The first item in the array will be the most recently created log file. - **/ -- (NSArray *)sortedLogFileInfos; - -// Private methods (only to be used by DDFileLogger) - -/** - * Generates a new unique log file path, and creates the corresponding log file. - **/ -- (NSString *)createNewLogFile; - -@optional - -// Notifications from DDFileLogger - -/** - * Called when a log file was archieved - */ -- (void)didArchiveLogFile:(NSString *)logFilePath; - -/** - * Called when the roll action was executed and the log was archieved - */ -- (void)didRollAndArchiveLogFile:(NSString *)logFilePath; - -@end - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#pragma mark - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * Default log file manager. - * - * All log files are placed inside the logsDirectory. - * If a specific logsDirectory isn't specified, the default directory is used. - * On Mac, this is in `~/Library/Logs/`. - * On iPhone, this is in `~/Library/Caches/Logs`. - * - * Log files are named `"