motion-yapper 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/.travis.yml +2 -0
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/motion-yapper.rb +1 -0
- data/lib/yapper.rb +3 -5
- data/lib/yapper/config.rb +2 -0
- data/lib/yapper/db.rb +105 -40
- data/lib/yapper/document.rb +7 -4
- data/lib/yapper/document/callbacks.rb +0 -7
- data/lib/yapper/document/{persistance.rb → persistence.rb} +27 -21
- data/lib/yapper/document/relation.rb +29 -22
- data/lib/yapper/document/selection.rb +122 -54
- data/lib/yapper/extensions.rb +12 -24
- data/lib/yapper/settings.rb +43 -0
- data/lib/yapper/timestamps.rb +2 -0
- data/lib/yapper/version.rb +1 -1
- data/{yapper.gemspec → motion-yapper.gemspec} +0 -0
- data/spec/integration/{where_spec.rb → criteria_spec.rb} +78 -10
- data/spec/integration/db_spec.rb +70 -0
- data/spec/integration/defaults_spec.rb +37 -0
- data/spec/integration/extensions_spec.rb +14 -0
- data/spec/integration/{persistance_spec.rb → persistence_spec.rb} +0 -0
- data/spec/integration/relation_spec.rb +4 -4
- data/vendor/Podfile.lock +9 -11
- data/vendor/Pods/.build/libPods-CocoaLumberjack.a +0 -0
- data/vendor/Pods/.build/libPods-NSData+MD5Digest.a +0 -0
- data/vendor/Pods/.build/libPods-YapDatabase.a +0 -0
- data/vendor/Pods/.build/libPods.a +0 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/{CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.h → BuildHeaders/CocoaLumberjack/DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +98 -65
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDMultiFormatter.h +30 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/BuildHeaders/YapDatabase/NSDictionary+YapDatabase.h +8 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +1 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +3 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +1 -1
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +35 -31
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -2
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +8 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +43 -21
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdgePrivate.h +79 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipPrivate.h +125 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +10 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +48 -107
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +18 -1
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +51 -50
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +546 -546
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1093 -907
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +98 -65
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +873 -748
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +1284 -1243
- data/vendor/Pods/{BuildHeaders/CocoaLumberjack/ContextFilterLogFormatter.h → CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{ContextFilterLogFormatter.m → DDContextFilterLogFormatter.m} +70 -70
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.m +253 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.h +30 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.m +127 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +1 -1
- data/vendor/Pods/CocoaLumberjack/README.markdown +52 -15
- data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/Headers/CocoaLumberjack/{ContextFilterLogFormatter.h → DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/Headers/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +98 -65
- data/vendor/Pods/Headers/CocoaLumberjack/DDMultiFormatter.h +30 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +3 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +48 -107
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +2 -0
- data/vendor/Pods/Headers/____Pods-environment.h +15 -15
- data/vendor/Pods/Manifest.lock +9 -11
- data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +1 -1
- data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +2 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +1 -1
- data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +1 -1
- data/vendor/Pods/{Pods-Acknowledgements.markdown → Pods-acknowledgements.markdown} +0 -37
- data/vendor/Pods/{Pods-Acknowledgements.plist → Pods-acknowledgements.plist} +0 -45
- data/vendor/Pods/Pods-environment.h +15 -15
- data/vendor/Pods/Pods.xcconfig +3 -3
- data/vendor/Pods/Pods.xcodeproj/project.pbxproj +2426 -3155
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-CocoaLumberjack.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-NSData+MD5Digest.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-YapDatabase.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/xcschememanagement.plist +31 -0
- data/vendor/Pods/YapDatabase/README.md +3 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +0 -2
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +25 -41
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +403 -134
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +8 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +8 -8
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +113 -62
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +35 -31
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +25 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +1 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +25 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipEdgePrivate.h +79 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipPrivate.h +125 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.m +129 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.m +802 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.m +408 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.m +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.m +5254 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +10 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +9 -8
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +62 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +148 -45
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +18 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +15 -9
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +211 -64
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +48 -107
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +10 -7
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +13 -22
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +725 -244
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.h +8 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.m +19 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +1 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +1 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +3 -3
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +43 -21
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +4 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +3 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +5 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +84 -93
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +381 -209
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +587 -267
- data/vendor/Pods/{Pods.bridgesupport → build-iPhoneSimulator/Pods.bridgesupport} +633 -2557
- data/vendor/Pods/build-iPhoneSimulator/libPods.a +0 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +2 -1
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +2 -1
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +4 -2
- metadata +80 -108
- data/Gemfile.lock +0 -63
- data/lib/yapper/attachment.rb +0 -48
- data/lib/yapper/document/attachment.rb +0 -26
- data/lib/yapper/sync.rb +0 -134
- data/lib/yapper/sync/data.rb +0 -12
- data/lib/yapper/sync/event.rb +0 -194
- data/lib/yapper/sync/queue.rb +0 -164
- data/spec/integration/all_spec.rb +0 -40
- data/spec/integration/sync_spec.rb +0 -42
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +0 -1396
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +0 -327
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +0 -321
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +0 -150
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +0 -157
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +0 -143
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +0 -848
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +0 -167
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +0 -191
- data/vendor/Pods/AFNetworking/LICENSE +0 -19
- data/vendor/Pods/AFNetworking/README.md +0 -208
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/BuildHeaders/Reachability/Reachability.h +0 -109
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.m +0 -251
- data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/Headers/Reachability/Reachability.h +0 -109
- data/vendor/Pods/Headers/YapDatabase/YapCache.h +0 -90
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnectionState.h +0 -29
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseDefaults.h +0 -37
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionPrivate.h +0 -440
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -19
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchPrivate.h +0 -69
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseLogging.h +0 -158
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseManager.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapDatabasePrivate.h +0 -424
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +0 -73
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseStatement.h +0 -13
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseString.h +0 -121
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChangePrivate.h +0 -94
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappingsPrivate.h +0 -72
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPage.h +0 -36
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPageMetadata.h +0 -27
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPrivate.h +0 -153
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapMemoryTable.h +0 -74
- data/vendor/Pods/Headers/YapDatabase/YapNull.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapTouch.h +0 -15
- data/vendor/Pods/Headers/____Pods-AFNetworking-prefix.h +0 -17
- data/vendor/Pods/Headers/____Pods-Reachability-prefix.h +0 -5
- data/vendor/Pods/Pods-AFNetworking-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-AFNetworking-dummy.m +0 -5
- data/vendor/Pods/Pods-AFNetworking-prefix.pch +0 -17
- data/vendor/Pods/Pods-AFNetworking.xcconfig +0 -1
- data/vendor/Pods/Pods-Reachability-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-Reachability-dummy.m +0 -5
- data/vendor/Pods/Pods-Reachability-prefix.pch +0 -5
- data/vendor/Pods/Pods-Reachability.xcconfig +0 -1
- data/vendor/Pods/Reachability/LICENCE.txt +0 -24
- data/vendor/Pods/Reachability/README.md +0 -65
- data/vendor/Pods/Reachability/Reachability.h +0 -109
- data/vendor/Pods/Reachability/Reachability.m +0 -527
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* Welcome to Cocoa Lumberjack!
|
|
7
7
|
*
|
|
8
8
|
* The project page has a wealth of documentation if you have any questions.
|
|
9
|
-
* https://github.com/
|
|
9
|
+
* https://github.com/CocoaLumberjack/CocoaLumberjack
|
|
10
10
|
*
|
|
11
11
|
* If you're new to the project you may wish to read the "Getting Started" wiki.
|
|
12
|
-
* https://github.com/
|
|
12
|
+
* https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted
|
|
13
13
|
*
|
|
14
14
|
*
|
|
15
15
|
* This class provides an abstract implementation of a database logger.
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
|
|
22
22
|
@interface DDAbstractDatabaseLogger : DDAbstractLogger {
|
|
23
23
|
@protected
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
NSUInteger saveThreshold;
|
|
25
|
+
NSTimeInterval saveInterval;
|
|
26
|
+
NSTimeInterval maxAge;
|
|
27
|
+
NSTimeInterval deleteInterval;
|
|
28
|
+
BOOL deleteOnEverySave;
|
|
29
|
+
|
|
30
|
+
BOOL saveTimerSuspended;
|
|
31
|
+
NSUInteger unsavedCount;
|
|
32
|
+
dispatch_time_t unsavedTime;
|
|
33
|
+
dispatch_source_t saveTimer;
|
|
34
|
+
dispatch_time_t lastDeleteTime;
|
|
35
|
+
dispatch_source_t deleteTimer;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* Welcome to Cocoa Lumberjack!
|
|
6
6
|
*
|
|
7
7
|
* The project page has a wealth of documentation if you have any questions.
|
|
8
|
-
* https://github.com/
|
|
8
|
+
* https://github.com/CocoaLumberjack/CocoaLumberjack
|
|
9
9
|
*
|
|
10
10
|
* If you're new to the project you may wish to read the "Getting Started" wiki.
|
|
11
|
-
* https://github.com/
|
|
11
|
+
* https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted
|
|
12
12
|
**/
|
|
13
13
|
|
|
14
14
|
#if ! __has_feature(objc_arc)
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
|
|
27
27
|
- (id)init
|
|
28
28
|
{
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
if ((self = [super init]))
|
|
30
|
+
{
|
|
31
31
|
saveThreshold = 500;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
saveInterval = 60; // 60 seconds
|
|
33
|
+
maxAge = (60 * 60 * 24 * 7); // 7 days
|
|
34
|
+
deleteInterval = (60 * 5); // 5 minutes
|
|
35
|
+
}
|
|
36
|
+
return self;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
- (void)dealloc
|
|
40
40
|
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
[self destroySaveTimer];
|
|
42
|
+
[self destroyDeleteTimer];
|
|
43
|
+
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -49,27 +49,27 @@
|
|
|
49
49
|
|
|
50
50
|
- (BOOL)db_log:(DDLogMessage *)logMessage
|
|
51
51
|
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
// Override me and add your implementation.
|
|
53
|
+
//
|
|
54
|
+
// Return YES if an item was added to the buffer.
|
|
55
|
+
// Return NO if the logMessage was ignored.
|
|
56
|
+
|
|
57
|
+
return NO;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
- (void)db_save
|
|
61
61
|
{
|
|
62
|
-
|
|
62
|
+
// Override me and add your implementation.
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
- (void)db_delete
|
|
66
66
|
{
|
|
67
|
-
|
|
67
|
+
// Override me and add your implementation.
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
- (void)db_saveAndDelete
|
|
71
71
|
{
|
|
72
|
-
|
|
72
|
+
// Override me and add your implementation.
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -78,32 +78,32 @@
|
|
|
78
78
|
|
|
79
79
|
- (void)performSaveAndSuspendSaveTimer
|
|
80
80
|
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
81
|
+
if (unsavedCount > 0)
|
|
82
|
+
{
|
|
83
|
+
if (deleteOnEverySave)
|
|
84
|
+
[self db_saveAndDelete];
|
|
85
|
+
else
|
|
86
|
+
[self db_save];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
unsavedCount = 0;
|
|
90
|
+
unsavedTime = 0;
|
|
91
|
+
|
|
92
|
+
if (saveTimer && !saveTimerSuspended)
|
|
93
|
+
{
|
|
94
|
+
dispatch_suspend(saveTimer);
|
|
95
|
+
saveTimerSuspended = YES;
|
|
96
|
+
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
- (void)performDelete
|
|
100
100
|
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
if (maxAge > 0.0)
|
|
102
|
+
{
|
|
103
|
+
[self db_delete];
|
|
104
|
+
|
|
105
|
+
lastDeleteTime = dispatch_time(DISPATCH_TIME_NOW, 0);
|
|
106
|
+
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -112,88 +112,88 @@
|
|
|
112
112
|
|
|
113
113
|
- (void)destroySaveTimer
|
|
114
114
|
{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
115
|
+
if (saveTimer)
|
|
116
|
+
{
|
|
117
|
+
dispatch_source_cancel(saveTimer);
|
|
118
|
+
if (saveTimerSuspended)
|
|
119
|
+
{
|
|
120
|
+
// Must resume a timer before releasing it (or it will crash)
|
|
121
|
+
dispatch_resume(saveTimer);
|
|
122
|
+
saveTimerSuspended = NO;
|
|
123
|
+
}
|
|
124
|
+
#if !OS_OBJECT_USE_OBJC
|
|
125
|
+
dispatch_release(saveTimer);
|
|
126
|
+
#endif
|
|
127
|
+
saveTimer = NULL;
|
|
128
|
+
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
- (void)updateAndResumeSaveTimer
|
|
132
132
|
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
133
|
+
if ((saveTimer != NULL) && (saveInterval > 0.0) && (unsavedTime > 0.0))
|
|
134
|
+
{
|
|
135
|
+
uint64_t interval = (uint64_t)(saveInterval * NSEC_PER_SEC);
|
|
136
|
+
dispatch_time_t startTime = dispatch_time(unsavedTime, interval);
|
|
137
|
+
|
|
138
|
+
dispatch_source_set_timer(saveTimer, startTime, interval, 1.0);
|
|
139
|
+
|
|
140
|
+
if (saveTimerSuspended)
|
|
141
|
+
{
|
|
142
|
+
dispatch_resume(saveTimer);
|
|
143
|
+
saveTimerSuspended = NO;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
- (void)createSuspendedSaveTimer
|
|
149
149
|
{
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
150
|
+
if ((saveTimer == NULL) && (saveInterval > 0.0))
|
|
151
|
+
{
|
|
152
|
+
saveTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, loggerQueue);
|
|
153
|
+
|
|
154
|
+
dispatch_source_set_event_handler(saveTimer, ^{ @autoreleasepool {
|
|
155
|
+
|
|
156
|
+
[self performSaveAndSuspendSaveTimer];
|
|
157
|
+
|
|
158
|
+
}});
|
|
159
|
+
|
|
160
|
+
saveTimerSuspended = YES;
|
|
161
|
+
}
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
- (void)destroyDeleteTimer
|
|
165
165
|
{
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
166
|
+
if (deleteTimer)
|
|
167
|
+
{
|
|
168
|
+
dispatch_source_cancel(deleteTimer);
|
|
169
|
+
#if !OS_OBJECT_USE_OBJC
|
|
170
|
+
dispatch_release(deleteTimer);
|
|
171
|
+
#endif
|
|
172
|
+
deleteTimer = NULL;
|
|
173
|
+
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
- (void)updateDeleteTimer
|
|
177
177
|
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
178
|
+
if ((deleteTimer != NULL) && (deleteInterval > 0.0) && (maxAge > 0.0))
|
|
179
|
+
{
|
|
180
|
+
uint64_t interval = (uint64_t)(deleteInterval * NSEC_PER_SEC);
|
|
181
|
+
dispatch_time_t startTime;
|
|
182
|
+
|
|
183
|
+
if (lastDeleteTime > 0)
|
|
184
|
+
startTime = dispatch_time(lastDeleteTime, interval);
|
|
185
|
+
else
|
|
186
|
+
startTime = dispatch_time(DISPATCH_TIME_NOW, interval);
|
|
187
|
+
|
|
188
|
+
dispatch_source_set_timer(deleteTimer, startTime, interval, 1.0);
|
|
189
|
+
}
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
- (void)createAndStartDeleteTimer
|
|
193
193
|
{
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
if ((deleteTimer == NULL) && (deleteInterval > 0.0) && (maxAge > 0.0))
|
|
195
|
+
{
|
|
196
|
+
deleteTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, loggerQueue);
|
|
197
197
|
|
|
198
198
|
if (deleteTimer != NULL) {
|
|
199
199
|
dispatch_source_set_event_handler(deleteTimer, ^{ @autoreleasepool {
|
|
@@ -204,9 +204,9 @@
|
|
|
204
204
|
|
|
205
205
|
[self updateDeleteTimer];
|
|
206
206
|
|
|
207
|
-
dispatch_resume(deleteTimer);
|
|
207
|
+
if (deleteTimer != NULL) dispatch_resume(deleteTimer);
|
|
208
208
|
}
|
|
209
|
-
|
|
209
|
+
}
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -215,432 +215,432 @@
|
|
|
215
215
|
|
|
216
216
|
- (NSUInteger)saveThreshold
|
|
217
217
|
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
218
|
+
// The design of this method is taken from the DDAbstractLogger implementation.
|
|
219
|
+
// For extensive documentation please refer to the DDAbstractLogger implementation.
|
|
220
|
+
|
|
221
|
+
// Note: The internal implementation MUST access the colorsEnabled variable directly,
|
|
222
|
+
// This method is designed explicitly for external access.
|
|
223
|
+
//
|
|
224
|
+
// Using "self." syntax to go through this method will cause immediate deadlock.
|
|
225
|
+
// This is the intended result. Fix it by accessing the ivar directly.
|
|
226
|
+
// Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
|
|
227
|
+
|
|
228
|
+
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
|
|
229
|
+
NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
|
|
230
|
+
|
|
231
|
+
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
|
|
232
|
+
|
|
233
|
+
__block NSUInteger result;
|
|
234
|
+
|
|
235
|
+
dispatch_sync(globalLoggingQueue, ^{
|
|
236
|
+
dispatch_sync(loggerQueue, ^{
|
|
237
|
+
result = saveThreshold;
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
return result;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
- (void)setSaveThreshold:(NSUInteger)threshold
|
|
245
245
|
{
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
246
|
+
dispatch_block_t block = ^{ @autoreleasepool {
|
|
247
|
+
|
|
248
|
+
if (saveThreshold != threshold)
|
|
249
|
+
{
|
|
250
|
+
saveThreshold = threshold;
|
|
251
|
+
|
|
252
|
+
// Since the saveThreshold has changed,
|
|
253
|
+
// we check to see if the current unsavedCount has surpassed the new threshold.
|
|
254
|
+
//
|
|
255
|
+
// If it has, we immediately save the log.
|
|
256
|
+
|
|
257
|
+
if ((unsavedCount >= saveThreshold) && (saveThreshold > 0))
|
|
258
|
+
{
|
|
259
|
+
[self performSaveAndSuspendSaveTimer];
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}};
|
|
263
|
+
|
|
264
|
+
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
|
|
265
|
+
// For documentation please refer to the DDAbstractLogger implementation.
|
|
266
|
+
|
|
267
|
+
if ([self isOnInternalLoggerQueue])
|
|
268
|
+
{
|
|
269
|
+
block();
|
|
270
|
+
}
|
|
271
|
+
else
|
|
272
|
+
{
|
|
273
|
+
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
|
|
274
|
+
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
|
|
275
|
+
|
|
276
|
+
dispatch_async(globalLoggingQueue, ^{
|
|
277
|
+
dispatch_async(loggerQueue, block);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
- (NSTimeInterval)saveInterval
|
|
283
283
|
{
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
284
|
+
// The design of this method is taken from the DDAbstractLogger implementation.
|
|
285
|
+
// For extensive documentation please refer to the DDAbstractLogger implementation.
|
|
286
|
+
|
|
287
|
+
// Note: The internal implementation MUST access the colorsEnabled variable directly,
|
|
288
|
+
// This method is designed explicitly for external access.
|
|
289
|
+
//
|
|
290
|
+
// Using "self." syntax to go through this method will cause immediate deadlock.
|
|
291
|
+
// This is the intended result. Fix it by accessing the ivar directly.
|
|
292
|
+
// Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
|
|
293
|
+
|
|
294
|
+
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
|
|
295
|
+
NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
|
|
296
|
+
|
|
297
|
+
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
|
|
298
|
+
|
|
299
|
+
__block NSTimeInterval result;
|
|
300
|
+
|
|
301
|
+
dispatch_sync(globalLoggingQueue, ^{
|
|
302
|
+
dispatch_sync(loggerQueue, ^{
|
|
303
|
+
result = saveInterval;
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
return result;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
- (void)setSaveInterval:(NSTimeInterval)interval
|
|
311
311
|
{
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
312
|
+
dispatch_block_t block = ^{ @autoreleasepool {
|
|
313
|
+
|
|
314
|
+
// C99 recommended floating point comparison macro
|
|
315
|
+
// Read: isLessThanOrGreaterThan(floatA, floatB)
|
|
316
|
+
|
|
317
|
+
if (/* saveInterval != interval */ islessgreater(saveInterval, interval))
|
|
318
|
+
{
|
|
319
|
+
saveInterval = interval;
|
|
320
|
+
|
|
321
|
+
// There are several cases we need to handle here.
|
|
322
|
+
//
|
|
323
|
+
// 1. If the saveInterval was previously enabled and it just got disabled,
|
|
324
|
+
// then we need to stop the saveTimer. (And we might as well release it.)
|
|
325
|
+
//
|
|
326
|
+
// 2. If the saveInterval was previously disabled and it just got enabled,
|
|
327
|
+
// then we need to setup the saveTimer. (Plus we might need to do an immediate save.)
|
|
328
|
+
//
|
|
329
|
+
// 3. If the saveInterval increased, then we need to reset the timer so that it fires at the later date.
|
|
330
|
+
//
|
|
331
|
+
// 4. If the saveInterval decreased, then we need to reset the timer so that it fires at an earlier date.
|
|
332
|
+
// (Plus we might need to do an immediate save.)
|
|
333
|
+
|
|
334
|
+
if (saveInterval > 0.0)
|
|
335
|
+
{
|
|
336
|
+
if (saveTimer == NULL)
|
|
337
|
+
{
|
|
338
|
+
// Handles #2
|
|
339
|
+
//
|
|
340
|
+
// Since the saveTimer uses the unsavedTime to calculate it's first fireDate,
|
|
341
|
+
// if a save is needed the timer will fire immediately.
|
|
342
|
+
|
|
343
|
+
[self createSuspendedSaveTimer];
|
|
344
|
+
[self updateAndResumeSaveTimer];
|
|
345
|
+
}
|
|
346
|
+
else
|
|
347
|
+
{
|
|
348
|
+
// Handles #3
|
|
349
|
+
// Handles #4
|
|
350
|
+
//
|
|
351
|
+
// Since the saveTimer uses the unsavedTime to calculate it's first fireDate,
|
|
352
|
+
// if a save is needed the timer will fire immediately.
|
|
353
|
+
|
|
354
|
+
[self updateAndResumeSaveTimer];
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
else if (saveTimer)
|
|
358
|
+
{
|
|
359
|
+
// Handles #1
|
|
360
|
+
|
|
361
|
+
[self destroySaveTimer];
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}};
|
|
365
|
+
|
|
366
|
+
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
|
|
367
|
+
// For documentation please refer to the DDAbstractLogger implementation.
|
|
368
|
+
|
|
369
|
+
if ([self isOnInternalLoggerQueue])
|
|
370
|
+
{
|
|
371
|
+
block();
|
|
372
|
+
}
|
|
373
|
+
else
|
|
374
|
+
{
|
|
375
|
+
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
|
|
376
|
+
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
|
|
377
|
+
|
|
378
|
+
dispatch_async(globalLoggingQueue, ^{
|
|
379
|
+
dispatch_async(loggerQueue, block);
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
- (NSTimeInterval)maxAge
|
|
385
385
|
{
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
386
|
+
// The design of this method is taken from the DDAbstractLogger implementation.
|
|
387
|
+
// For extensive documentation please refer to the DDAbstractLogger implementation.
|
|
388
|
+
|
|
389
|
+
// Note: The internal implementation MUST access the colorsEnabled variable directly,
|
|
390
|
+
// This method is designed explicitly for external access.
|
|
391
|
+
//
|
|
392
|
+
// Using "self." syntax to go through this method will cause immediate deadlock.
|
|
393
|
+
// This is the intended result. Fix it by accessing the ivar directly.
|
|
394
|
+
// Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
|
|
395
|
+
|
|
396
|
+
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
|
|
397
|
+
NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
|
|
398
|
+
|
|
399
|
+
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
|
|
400
|
+
|
|
401
|
+
__block NSTimeInterval result;
|
|
402
|
+
|
|
403
|
+
dispatch_sync(globalLoggingQueue, ^{
|
|
404
|
+
dispatch_sync(loggerQueue, ^{
|
|
405
|
+
result = maxAge;
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
return result;
|
|
410
410
|
}
|
|
411
411
|
|
|
412
412
|
- (void)setMaxAge:(NSTimeInterval)interval
|
|
413
413
|
{
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
414
|
+
dispatch_block_t block = ^{ @autoreleasepool {
|
|
415
|
+
|
|
416
|
+
// C99 recommended floating point comparison macro
|
|
417
|
+
// Read: isLessThanOrGreaterThan(floatA, floatB)
|
|
418
|
+
|
|
419
|
+
if (/* maxAge != interval */ islessgreater(maxAge, interval))
|
|
420
|
+
{
|
|
421
|
+
NSTimeInterval oldMaxAge = maxAge;
|
|
422
|
+
NSTimeInterval newMaxAge = interval;
|
|
423
|
+
|
|
424
|
+
maxAge = interval;
|
|
425
|
+
|
|
426
|
+
// There are several cases we need to handle here.
|
|
427
|
+
//
|
|
428
|
+
// 1. If the maxAge was previously enabled and it just got disabled,
|
|
429
|
+
// then we need to stop the deleteTimer. (And we might as well release it.)
|
|
430
|
+
//
|
|
431
|
+
// 2. If the maxAge was previously disabled and it just got enabled,
|
|
432
|
+
// then we need to setup the deleteTimer. (Plus we might need to do an immediate delete.)
|
|
433
|
+
//
|
|
434
|
+
// 3. If the maxAge was increased,
|
|
435
|
+
// then we don't need to do anything.
|
|
436
|
+
//
|
|
437
|
+
// 4. If the maxAge was decreased,
|
|
438
|
+
// then we should do an immediate delete.
|
|
439
|
+
|
|
440
|
+
BOOL shouldDeleteNow = NO;
|
|
441
|
+
|
|
442
|
+
if (oldMaxAge > 0.0)
|
|
443
|
+
{
|
|
444
|
+
if (newMaxAge <= 0.0)
|
|
445
|
+
{
|
|
446
|
+
// Handles #1
|
|
447
|
+
|
|
448
|
+
[self destroyDeleteTimer];
|
|
449
|
+
}
|
|
450
|
+
else if (oldMaxAge > newMaxAge)
|
|
451
|
+
{
|
|
452
|
+
// Handles #4
|
|
453
|
+
shouldDeleteNow = YES;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
else if (newMaxAge > 0.0)
|
|
457
|
+
{
|
|
458
|
+
// Handles #2
|
|
459
|
+
shouldDeleteNow = YES;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (shouldDeleteNow)
|
|
463
|
+
{
|
|
464
|
+
[self performDelete];
|
|
465
|
+
|
|
466
|
+
if (deleteTimer)
|
|
467
|
+
[self updateDeleteTimer];
|
|
468
|
+
else
|
|
469
|
+
[self createAndStartDeleteTimer];
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}};
|
|
473
|
+
|
|
474
|
+
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
|
|
475
|
+
// For documentation please refer to the DDAbstractLogger implementation.
|
|
476
|
+
|
|
477
|
+
if ([self isOnInternalLoggerQueue])
|
|
478
|
+
{
|
|
479
|
+
block();
|
|
480
|
+
}
|
|
481
|
+
else
|
|
482
|
+
{
|
|
483
|
+
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
|
|
484
|
+
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
|
|
485
|
+
|
|
486
|
+
dispatch_async(globalLoggingQueue, ^{
|
|
487
|
+
dispatch_async(loggerQueue, block);
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
490
|
}
|
|
491
491
|
|
|
492
492
|
- (NSTimeInterval)deleteInterval
|
|
493
493
|
{
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
494
|
+
// The design of this method is taken from the DDAbstractLogger implementation.
|
|
495
|
+
// For extensive documentation please refer to the DDAbstractLogger implementation.
|
|
496
|
+
|
|
497
|
+
// Note: The internal implementation MUST access the colorsEnabled variable directly,
|
|
498
|
+
// This method is designed explicitly for external access.
|
|
499
|
+
//
|
|
500
|
+
// Using "self." syntax to go through this method will cause immediate deadlock.
|
|
501
|
+
// This is the intended result. Fix it by accessing the ivar directly.
|
|
502
|
+
// Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
|
|
503
|
+
|
|
504
|
+
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
|
|
505
|
+
NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
|
|
506
|
+
|
|
507
|
+
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
|
|
508
|
+
|
|
509
|
+
__block NSTimeInterval result;
|
|
510
|
+
|
|
511
|
+
dispatch_sync(globalLoggingQueue, ^{
|
|
512
|
+
dispatch_sync(loggerQueue, ^{
|
|
513
|
+
result = deleteInterval;
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
return result;
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
- (void)setDeleteInterval:(NSTimeInterval)interval
|
|
521
521
|
{
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
522
|
+
dispatch_block_t block = ^{ @autoreleasepool {
|
|
523
|
+
|
|
524
|
+
// C99 recommended floating point comparison macro
|
|
525
|
+
// Read: isLessThanOrGreaterThan(floatA, floatB)
|
|
526
|
+
|
|
527
|
+
if (/* deleteInterval != interval */ islessgreater(deleteInterval, interval))
|
|
528
|
+
{
|
|
529
|
+
deleteInterval = interval;
|
|
530
|
+
|
|
531
|
+
// There are several cases we need to handle here.
|
|
532
|
+
//
|
|
533
|
+
// 1. If the deleteInterval was previously enabled and it just got disabled,
|
|
534
|
+
// then we need to stop the deleteTimer. (And we might as well release it.)
|
|
535
|
+
//
|
|
536
|
+
// 2. If the deleteInterval was previously disabled and it just got enabled,
|
|
537
|
+
// then we need to setup the deleteTimer. (Plus we might need to do an immediate delete.)
|
|
538
|
+
//
|
|
539
|
+
// 3. If the deleteInterval increased, then we need to reset the timer so that it fires at the later date.
|
|
540
|
+
//
|
|
541
|
+
// 4. If the deleteInterval decreased, then we need to reset the timer so that it fires at an earlier date.
|
|
542
|
+
// (Plus we might need to do an immediate delete.)
|
|
543
|
+
|
|
544
|
+
if (deleteInterval > 0.0)
|
|
545
|
+
{
|
|
546
|
+
if (deleteTimer == NULL)
|
|
547
|
+
{
|
|
548
|
+
// Handles #2
|
|
549
|
+
//
|
|
550
|
+
// Since the deleteTimer uses the lastDeleteTime to calculate it's first fireDate,
|
|
551
|
+
// if a delete is needed the timer will fire immediately.
|
|
552
|
+
|
|
553
|
+
[self createAndStartDeleteTimer];
|
|
554
|
+
}
|
|
555
|
+
else
|
|
556
|
+
{
|
|
557
|
+
// Handles #3
|
|
558
|
+
// Handles #4
|
|
559
|
+
//
|
|
560
|
+
// Since the deleteTimer uses the lastDeleteTime to calculate it's first fireDate,
|
|
561
|
+
// if a save is needed the timer will fire immediately.
|
|
562
|
+
|
|
563
|
+
[self updateDeleteTimer];
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
else if (deleteTimer)
|
|
567
|
+
{
|
|
568
|
+
// Handles #1
|
|
569
|
+
|
|
570
|
+
[self destroyDeleteTimer];
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}};
|
|
574
|
+
|
|
575
|
+
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
|
|
576
|
+
// For documentation please refer to the DDAbstractLogger implementation.
|
|
577
|
+
|
|
578
|
+
if ([self isOnInternalLoggerQueue])
|
|
579
|
+
{
|
|
580
|
+
block();
|
|
581
|
+
}
|
|
582
|
+
else
|
|
583
|
+
{
|
|
584
|
+
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
|
|
585
|
+
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
|
|
586
|
+
|
|
587
|
+
dispatch_async(globalLoggingQueue, ^{
|
|
588
|
+
dispatch_async(loggerQueue, block);
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
591
|
}
|
|
592
592
|
|
|
593
593
|
- (BOOL)deleteOnEverySave
|
|
594
594
|
{
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
595
|
+
// The design of this method is taken from the DDAbstractLogger implementation.
|
|
596
|
+
// For extensive documentation please refer to the DDAbstractLogger implementation.
|
|
597
|
+
|
|
598
|
+
// Note: The internal implementation MUST access the colorsEnabled variable directly,
|
|
599
|
+
// This method is designed explicitly for external access.
|
|
600
|
+
//
|
|
601
|
+
// Using "self." syntax to go through this method will cause immediate deadlock.
|
|
602
|
+
// This is the intended result. Fix it by accessing the ivar directly.
|
|
603
|
+
// Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
|
|
604
|
+
|
|
605
|
+
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
|
|
606
|
+
NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
|
|
607
|
+
|
|
608
|
+
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
|
|
609
|
+
|
|
610
|
+
__block BOOL result;
|
|
611
|
+
|
|
612
|
+
dispatch_sync(globalLoggingQueue, ^{
|
|
613
|
+
dispatch_sync(loggerQueue, ^{
|
|
614
|
+
result = deleteOnEverySave;
|
|
615
|
+
});
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
return result;
|
|
619
619
|
}
|
|
620
620
|
|
|
621
621
|
- (void)setDeleteOnEverySave:(BOOL)flag
|
|
622
622
|
{
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
623
|
+
dispatch_block_t block = ^{
|
|
624
|
+
|
|
625
|
+
deleteOnEverySave = flag;
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
|
|
629
|
+
// For documentation please refer to the DDAbstractLogger implementation.
|
|
630
|
+
|
|
631
|
+
if ([self isOnInternalLoggerQueue])
|
|
632
|
+
{
|
|
633
|
+
block();
|
|
634
|
+
}
|
|
635
|
+
else
|
|
636
|
+
{
|
|
637
|
+
dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue];
|
|
638
|
+
NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
|
|
639
|
+
|
|
640
|
+
dispatch_async(globalLoggingQueue, ^{
|
|
641
|
+
dispatch_async(loggerQueue, block);
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
644
|
}
|
|
645
645
|
|
|
646
646
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -649,28 +649,28 @@
|
|
|
649
649
|
|
|
650
650
|
- (void)savePendingLogEntries
|
|
651
651
|
{
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
652
|
+
dispatch_block_t block = ^{ @autoreleasepool {
|
|
653
|
+
|
|
654
|
+
[self performSaveAndSuspendSaveTimer];
|
|
655
|
+
}};
|
|
656
|
+
|
|
657
|
+
if ([self isOnInternalLoggerQueue])
|
|
658
|
+
block();
|
|
659
|
+
else
|
|
660
|
+
dispatch_async(loggerQueue, block);
|
|
661
661
|
}
|
|
662
662
|
|
|
663
663
|
- (void)deleteOldLogEntries
|
|
664
664
|
{
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
665
|
+
dispatch_block_t block = ^{ @autoreleasepool {
|
|
666
|
+
|
|
667
|
+
[self performDelete];
|
|
668
|
+
}};
|
|
669
|
+
|
|
670
|
+
if ([self isOnInternalLoggerQueue])
|
|
671
|
+
block();
|
|
672
|
+
else
|
|
673
|
+
dispatch_async(loggerQueue, block);
|
|
674
674
|
}
|
|
675
675
|
|
|
676
676
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -679,49 +679,49 @@
|
|
|
679
679
|
|
|
680
680
|
- (void)didAddLogger
|
|
681
681
|
{
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
682
|
+
// If you override me be sure to invoke [super didAddLogger];
|
|
683
|
+
|
|
684
|
+
[self createSuspendedSaveTimer];
|
|
685
|
+
|
|
686
|
+
[self createAndStartDeleteTimer];
|
|
687
687
|
}
|
|
688
688
|
|
|
689
689
|
- (void)willRemoveLogger
|
|
690
690
|
{
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
691
|
+
// If you override me be sure to invoke [super willRemoveLogger];
|
|
692
|
+
|
|
693
|
+
[self performSaveAndSuspendSaveTimer];
|
|
694
|
+
|
|
695
|
+
[self destroySaveTimer];
|
|
696
|
+
[self destroyDeleteTimer];
|
|
697
697
|
}
|
|
698
698
|
|
|
699
699
|
- (void)logMessage:(DDLogMessage *)logMessage
|
|
700
700
|
{
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
701
|
+
if ([self db_log:logMessage])
|
|
702
|
+
{
|
|
703
|
+
BOOL firstUnsavedEntry = (++unsavedCount == 1);
|
|
704
|
+
|
|
705
|
+
if ((unsavedCount >= saveThreshold) && (saveThreshold > 0))
|
|
706
|
+
{
|
|
707
|
+
[self performSaveAndSuspendSaveTimer];
|
|
708
|
+
}
|
|
709
|
+
else if (firstUnsavedEntry)
|
|
710
|
+
{
|
|
711
|
+
unsavedTime = dispatch_time(DISPATCH_TIME_NOW, 0);
|
|
712
|
+
[self updateAndResumeSaveTimer];
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
715
|
}
|
|
716
716
|
|
|
717
717
|
- (void)flush
|
|
718
718
|
{
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
719
|
+
// This method is invoked by DDLog's flushLog method.
|
|
720
|
+
//
|
|
721
|
+
// It is called automatically when the application quits,
|
|
722
|
+
// or if the developer invokes DDLog's flushLog method prior to crashing or something.
|
|
723
|
+
|
|
724
|
+
[self performSaveAndSuspendSaveTimer];
|
|
725
725
|
}
|
|
726
726
|
|
|
727
727
|
@end
|