Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fae1ec38c9 | ||
|
|
fae121b59b | ||
|
|
fae137a76c | ||
|
|
fae133c65c | ||
|
|
fae18352f5 | ||
|
|
fae16445c4 | ||
|
|
fae13868f1 | ||
|
|
711ebbef25 | ||
|
|
10af3f23a2 |
+3
-3
@@ -1,4 +1,4 @@
|
||||
github "CocoaLumberjack/CocoaLumberjack" "3.7.0"
|
||||
github "SwiftyJSON/SwiftyJSON" "5.0.0"
|
||||
github "CocoaLumberjack/CocoaLumberjack" "3.7.2"
|
||||
github "SwiftyJSON/SwiftyJSON" "5.0.1"
|
||||
github "acheronfail/MASShortcut" "2.3.6-custom"
|
||||
github "sindresorhus/LaunchAtLogin" "v4.0.0"
|
||||
github "sindresorhus/LaunchAtLogin" "v4.2.0"
|
||||
|
||||
@@ -8,3 +8,6 @@ opt_in_rules:
|
||||
|
||||
nesting:
|
||||
type_level: 4
|
||||
|
||||
identifier_name:
|
||||
allowed_symbols: "_"
|
||||
|
||||
+75
-2
@@ -1,8 +1,39 @@
|
||||
## [3.7.1 - Xcode 12 on ???, 2020](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.0)
|
||||
## [3.7.3 - Xcode 12.? on ??, 2021](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.3)
|
||||
|
||||
### Public
|
||||
|
||||
- _TBD_
|
||||
- _REPLACE ME_
|
||||
|
||||
### Internal
|
||||
|
||||
- _REPLACE ME_
|
||||
|
||||
|
||||
## [3.7.2 - Xcode 12.4 on Apr 9th, 2021](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.2)
|
||||
|
||||
### Public
|
||||
|
||||
- Re-introduce (and deprecate) `_tag` field to fix breakage in 3.7.1 (#1224)
|
||||
|
||||
|
||||
## [3.7.1 - Xcode 12.4 on Apr 7th, 2021](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.1)
|
||||
|
||||
### Public
|
||||
|
||||
- Deprecate `tag` property of `DDLogMessage`, use `representedObject` instead. (#1177, #532)
|
||||
- Add per-message synchronous logging control for messages logged via SwiftLog using `DDLogHandler` (#1209)
|
||||
- Add TargetConditionals import for Xcode 12.5 (#1210)
|
||||
- Prevent logging an error when archiving an already deleted file (#1212)
|
||||
- Use inclusive words - denylist / allowlist (#1218)
|
||||
- Add `DDAssertionFailure` macro for Objective-C (#1220)
|
||||
|
||||
### Internal
|
||||
|
||||
- Use setter to replace kvo for `NSFileLogger` (#1180)
|
||||
- Use new API for `NSFileHandle` on supported platforms (#1181)
|
||||
- Remove unnecessary checks in `DDFileLogger` (#1182)
|
||||
- Add an assertion to avoid potential deadlock issues for `flushLog` (#1183)
|
||||
|
||||
|
||||
## [3.7.0 - Xcode 12 on Oct 2nd, 2020](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.0)
|
||||
|
||||
@@ -14,6 +45,7 @@
|
||||
- Specify CocoaPods version to ensure `swift_version` attribute works (#1167)
|
||||
- Simplify `DDLogFileManager` callbacks for archived log files (#1166)
|
||||
|
||||
|
||||
## [3.6.2 - Xcode 11.6 on July 31st, 2020](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.6.2)
|
||||
|
||||
### Public
|
||||
@@ -25,6 +57,7 @@
|
||||
### Repository
|
||||
- Switch from Travis to GitHub Actions (#1135, #1140, #1150, #1152)
|
||||
|
||||
|
||||
## [3.6.1 - Xcode 11.3.1 on Jan 25th, 2020](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.6.1)
|
||||
|
||||
### Public
|
||||
@@ -39,6 +72,7 @@
|
||||
- Fix NSDateFormatter thread safety (#1121)
|
||||
- Fix -lt_dataForMessage: duplicated code (#1122)
|
||||
|
||||
|
||||
## [3.6.0 - Xcode 11 on October 2nd, 2019](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.6.0)
|
||||
|
||||
### Public
|
||||
@@ -49,6 +83,7 @@
|
||||
- Fix issue with log archiving in the simulator (#1098)
|
||||
- Limit assertion to non-simulator build (#1100)
|
||||
|
||||
|
||||
## [3.5.3 - Xcode 10.2 on Apr 24th, 2019](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.5.3)
|
||||
|
||||
### Public
|
||||
@@ -63,6 +98,7 @@
|
||||
- Add CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER & fix warnings (#1059)
|
||||
- Use LLONG_MAX instead of LONG_LONG_MAX (#1062)
|
||||
|
||||
|
||||
## [3.5.2 - Xcode 10.1 on Mar 15th, 2019](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.5.2)
|
||||
|
||||
### Public
|
||||
@@ -75,11 +111,13 @@
|
||||
- Sync internal queues to prevent cleaning up log files too soon in tests (#1053)
|
||||
- DDLog checks for NULL values and for global queue dispatching has been added (#1045)
|
||||
|
||||
|
||||
## [3.5.1 - Xcode 10 on Feb 4th, 2019](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.5.1)
|
||||
|
||||
### Public
|
||||
- Fix high CPU usage because of empty fileAttributes and / or too high rollingFrequceny (#1028)
|
||||
|
||||
|
||||
## [3.5.0 - Xcode 10 on Jan 25th, 2019](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.5.0)
|
||||
|
||||
### Public
|
||||
@@ -114,6 +152,7 @@
|
||||
- Xcode (schemes) version bumps #938
|
||||
- Update demo and documentation about CustomLogLevels #1023
|
||||
|
||||
|
||||
## [3.4.2 - Xcode 9.3 on Apr 17th, 2018](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.4.2)
|
||||
- Update README.md #912
|
||||
- Fixed typo in pull request template #913
|
||||
@@ -123,19 +162,23 @@
|
||||
- Add extern "C" for Objective-C++ #922
|
||||
- Add `flush` method to the `DDFileLogger` #928
|
||||
|
||||
|
||||
## [3.4.1 - Xcode 9.1 on Jan 26th, 2018](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.4.1)
|
||||
- Fix `DDLogFileManagerDefault` `-isLogFile` #909
|
||||
- Fix locking the main thread #911
|
||||
|
||||
|
||||
## [3.4.0 - Xcode 9.1 on Jan 3rd, 2018](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.4.0)
|
||||
- Fix Travis CI #895
|
||||
- Fix typos #896
|
||||
- Fix schemes and link errors #897 #899 #903 #907
|
||||
|
||||
|
||||
## [3.3.0 - Xcode 9 on Oct 3rd, 2017](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.3.0)
|
||||
- Xcode 9 support and Swift 4 support #890 #893
|
||||
- Replace `OSSpinLock` with `pthread_mutex` #889
|
||||
|
||||
|
||||
## [3.2.1 - Xcode 9 beta on Aug 21st, 2017](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.2.1)
|
||||
- Xcode 9 beta support #874 #873 #884 #883 #882
|
||||
- Fixed some issues around deleting log files #868 #879
|
||||
@@ -143,6 +186,7 @@
|
||||
- Remove empty asset catalogs so that they don't show up in Open Quickly #877
|
||||
- Fixed typo in pull request template #880
|
||||
|
||||
|
||||
## [3.2.0 - Swift 3.0.0, Xcode 8.3 on May 3rd, 2017](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.2.0)
|
||||
- Xcode 8.3 support #860 #853
|
||||
- added a very basic `os_log` (unified logging) logger #850 #856
|
||||
@@ -154,6 +198,7 @@
|
||||
- Ignore `Carthage/Build` directory #862
|
||||
- Updated schemes #859 #857
|
||||
|
||||
|
||||
## [3.1.0 - Swift 3.0.1, Xcode 8.1 on Feb 22nd, 2017](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.1.0)
|
||||
- Swift 3.0.1 and Xcode 8.1 support via #816
|
||||
- Fix Carthage build and updated the podspec structure #819 #818 #784 #790 #782 #778 #815
|
||||
@@ -176,9 +221,11 @@
|
||||
- Fix Travis CI build #807
|
||||
- Updated docs #798 #808 #811 #810 #820
|
||||
|
||||
|
||||
## [3.0.0 - Swift 3.0, Xcode 8 on Sep 21st, 2016](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.0.0)
|
||||
- Swift 3.0 and Xcode 8 support via #769, fixes #771 and #772. Many thanks to @ffried @max-potapov @chrisdoc @BarakRL @devxoul and the others who contributed
|
||||
|
||||
|
||||
## [2.4.0 - Swift 2.3 on Sep 19th, 2016](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.4.0)
|
||||
- Swift 2.3 explicit so that the project compiles on Xcode 8 - #747 #773 fix #762 #763 #766
|
||||
- CocoaPods 1.0.0 fully adopted - 0f5a793 637dfc1 70439fe #729
|
||||
@@ -188,6 +235,7 @@
|
||||
- Added CONTRIBUTING, ISSUE and PULL_REQUEST TEMPLATE and added a small Communication section to the Readme
|
||||
- Fixed an issue with one demo #760
|
||||
|
||||
|
||||
## [2.3.0 - Swift 2.2, Xcode7.3 on May 2nd, 2016](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.3.0)
|
||||
- Updated to Swift 2.2 - #704
|
||||
- replaced deprecated `__FUNCTION__`, `__FILE__`, `__LINE__` with newly added to Swift 2.2: `#function`, `#file`, `#line`
|
||||
@@ -202,27 +250,33 @@
|
||||
- fixed typo in import - #693
|
||||
- updated the docs - #646 #650 #656 #655 #661 #664 #667 #684 #724
|
||||
|
||||
|
||||
## [2.2.0 - TVOS, Xcode7.1 on Oct 28th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.2.0)
|
||||
- added `tvOS` support (thanks [@sinoru](https://github.com/sinoru)) - [#634](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/634) [#640](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/640) [#630](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/630) [#628](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/628) [#618](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/618) [#611](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/611)
|
||||
- Remove `(escaping)` from the Swift `@autoclosure` parameters - [#642](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/642)
|
||||
|
||||
|
||||
## [2.1.0 - Swift 2.0, WatchOS, Xcode7 on Oct 23rd, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.1.0)
|
||||
- Fixed the version for the Carthage builds - see [#633](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/633)
|
||||
- Improved documentation
|
||||
|
||||
|
||||
## [2.1.0 RC - Swift 2.0, WatchOS, Xcode7 on Oct 22nd, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.1.0-rc)
|
||||
- Refactored the `NSDateFormatter` related code to fix a bunch of issues: [#621](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/621)
|
||||
- Fix Issue [#488](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/488): Support `DDLog` without `AppKit Dependency` (`#define DD_CLI`): [#627](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/627)
|
||||
- Re-add `NS_DESIGNATED_INITIALIZER` [#619](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/619)
|
||||
|
||||
|
||||
## [2.1.0 Beta - Swift 2.0, WatchOS, Xcode7 on Oct 12th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.1.0-beta)
|
||||
- Updated the library to use Swift 2.0 and Xcode 7 [#617](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/617) [#545](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/545) [#534](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/534)
|
||||
- WatchOS support (2.0) [#583](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/583) [#581](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/581) [#579](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/579)
|
||||
|
||||
|
||||
## [2.0.3 Patch for 2.0.0 on Oct 13th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.3)
|
||||
|
||||
- Compatibility with Xcode 6 that was broken by the 2.0.2 patch - [f042fd3](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/f042fd3)
|
||||
|
||||
|
||||
## [2.0.2 Patch for 2.0.0 on Oct 12th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.2)
|
||||
|
||||
- Swift 1.2 fixes [#546](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/546) [#578](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/578) plus and update to Swift 2.0 [5627dff](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/5627dff) imported from our swift_2.0 branch
|
||||
@@ -249,6 +303,7 @@
|
||||
- Updated `GettingStarted.md` to include `ddLogLevel` [#602](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/602)
|
||||
- Remove redundant check for `processorCount` availability [#604](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/604)
|
||||
|
||||
|
||||
## [2.0.1 Patch for 2.0.0 on Jun 25th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.1)
|
||||
|
||||
- **Carthage support** [#521](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/521) [#526](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/526)
|
||||
@@ -268,6 +323,7 @@
|
||||
- Change code samples to use `DDLogFlagWarning` [#520](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/520)
|
||||
- Fix seemingly obvious typo in the `toLogLevel` function [#508](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/508)
|
||||
|
||||
|
||||
## [CocoaLumberjack 2.0.0 on Mar 13th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0)
|
||||
|
||||
The library was strongly refactored, with a few goals in mind:
|
||||
@@ -278,6 +334,7 @@ The library was strongly refactored, with a few goals in mind:
|
||||
|
||||
See [Migration from 1.x to 2.x](https://github.com/CocoaLumberjack/CocoaLumberjack#migrating-to-2x)
|
||||
|
||||
|
||||
## [2.0.0-rc2 on Feb 20th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0-rc2)
|
||||
|
||||
- Bucket of Swift improvements - [#434](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/434) [#437](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/437) [#449](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/449) [#440](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/440)
|
||||
@@ -288,11 +345,13 @@ See [Migration from 1.x to 2.x](https://github.com/CocoaLumberjack/CocoaLumberja
|
||||
- Legacy checks updated - [#424](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/424)
|
||||
- Documentation updates
|
||||
|
||||
|
||||
## [2.0.0-rc on Dec 11th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0-rc)
|
||||
|
||||
- Fix `dispatch_queue_t` properties.
|
||||
- Fix `registeredClasses` crashes at launch.
|
||||
|
||||
|
||||
## [2.0.0-beta4 on Nov 7th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0-beta4)
|
||||
|
||||
- Major refactoring and clean up.
|
||||
@@ -300,6 +359,7 @@ See [Migration from 1.x to 2.x](https://github.com/CocoaLumberjack/CocoaLumberja
|
||||
- Preliminary Swift support through `CocoaLumberjack.swift`.
|
||||
- Automatic 1.9.x legacy support when `DDLog.h` is imported instead of the new `CocoaLumberjack.h`.
|
||||
|
||||
|
||||
## [2.0.0-beta3 on Oct 21st, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0-beta3)
|
||||
|
||||
- Modernize flag variables to be `NS_OPTIONS`/`NS_ENUM`.
|
||||
@@ -307,16 +367,19 @@ See [Migration from 1.x to 2.x](https://github.com/CocoaLumberjack/CocoaLumberja
|
||||
- Fix warning when compiled with assertions blocked.
|
||||
- Crash fixes.
|
||||
|
||||
|
||||
## [2.0.0-beta2 on Sep 30th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0-beta2)
|
||||
|
||||
- Cleanup code.
|
||||
- Match `NSLog` read UID functionality in `DDASLLogger`.
|
||||
- Update framework and static libraries.
|
||||
|
||||
|
||||
## [2.0.0 Beta on Aug 12th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0-beta)
|
||||
|
||||
See [Migrate from 1.x to 2.x](https://github.com/CocoaLumberjack/CocoaLumberjack#migrating-to-2x)
|
||||
|
||||
|
||||
## [1.9.2 Updated patch release for 1.9.0 on Aug 11th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.9.2)
|
||||
|
||||
- Fixed `NSCalendar components:fromDate:` crash - [#140](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/140) [#307](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/307) [#216](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/216)
|
||||
@@ -328,6 +391,7 @@ See [Migrate from 1.x to 2.x](https://github.com/CocoaLumberjack/CocoaLumberjack
|
||||
- Fixed `CompressingLogFileManager` compression bug - [#315](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/315)
|
||||
- Remove unnecessary `NULL` check before `free()` - [#316](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/316)
|
||||
|
||||
|
||||
## [1.9.1 Patch release for 1.9.0 on Jun 30th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.9.1)
|
||||
|
||||
- Fixed issues in rolling frequency - [#243](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/243) [#295](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/295) [@georgekola](https://github.com/georgekola)
|
||||
@@ -336,6 +400,7 @@ See [Migrate from 1.x to 2.x](https://github.com/CocoaLumberjack/CocoaLumberjack
|
||||
- Changed the `Build Active Architecture Only` to `NO` [#294](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/294) [#293](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/293)
|
||||
- Optimisation by reusing `NSDateFormatter` instances [#296](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/296) [#301](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/301)
|
||||
|
||||
|
||||
## [1.9.0 New ASL capture module, several File logger fixes on May 23rd, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.9.0)
|
||||
|
||||
- New ASL capture module [#242](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/242) [#263](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/263)
|
||||
@@ -363,6 +428,7 @@ See [Migrate from 1.x to 2.x](https://github.com/CocoaLumberjack/CocoaLumberjack
|
||||
- `DDTTYLogger`: Favour XcodeColors environment variable [#237](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/237)
|
||||
- `DDLog`: calling `atexit_b` in CLI applications, that use Foundation framework [#234](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/234)
|
||||
|
||||
|
||||
## [1.8.1 AllLoggers and bugfixes on Feb 14th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.8.1)
|
||||
|
||||
- read access to all loggers - [#217](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/217) [#219](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/219)
|
||||
@@ -372,6 +438,7 @@ See [Migrate from 1.x to 2.x](https://github.com/CocoaLumberjack/CocoaLumberjack
|
||||
- improved safety by using assertions instead of comments (`DDLog` in the core) - [#221](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/221)
|
||||
- added Lumberjack logo :)
|
||||
|
||||
|
||||
## [1.8.0 Better CL support, custom logfile name format, bugfixes on Jan 21st, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.8.0)
|
||||
|
||||
- `DDFileLogger` custom logfile (name) format - [#208](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/208)
|
||||
@@ -383,15 +450,18 @@ See [Migrate from 1.x to 2.x](https://github.com/CocoaLumberjack/CocoaLumberjack
|
||||
- `DDFileLogger`: fixed comment - [#199](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/199)
|
||||
- Fix Travis - [#205](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/205)
|
||||
|
||||
|
||||
## [1.7.0 New log file naming convention and CocoaLumberjack organisation on Dec 10th, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.7.0)
|
||||
|
||||
- new log file naming convention - [#191](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/191)
|
||||
- completed transition to **CocoaLumberjack** organisation - [#188](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/188)
|
||||
|
||||
|
||||
## [1.6.5.1 Patch release for Xcode 4.4+ compatibility on Dec 4th, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6.5.1)
|
||||
|
||||
- fixed compatibility with Xcode 4.4+ [#187](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/187)
|
||||
|
||||
|
||||
## [1.6.5 File Logger refactoring, Multi Formatter, preffixed extension classes on Dec 3rd, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6.5)
|
||||
|
||||
`DDFileLogger` refactoring and fixes (thanks [@dvor](https://github.com/dvor) and [@an0](https://github.com/an0)):
|
||||
@@ -411,6 +481,7 @@ Other:
|
||||
- Included `DDLog+LOGV.h` in Cocoapods sources [d253bd7](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/d253bd7)
|
||||
- other fixes/improvements
|
||||
|
||||
|
||||
## [1.6.4 Fix compatibility with 3rd party frameworks on Nov 21st, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6.4)
|
||||
|
||||
* "Fix" conflicts with 3rd party libraries using `CocoaLumberjack` [#172](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/172)
|
||||
@@ -418,6 +489,7 @@ Other:
|
||||
* Add new `DEBUG` log level support to included loggers [#166](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/166)
|
||||
* Method declarations that make it easier to extend/modify `DispatchQueueLogFormatter` [#164](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/164)
|
||||
|
||||
|
||||
## [1.6.3 New macros, updated podspec and bug fixes on Apr 2nd, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6.3)
|
||||
|
||||
* Add `LOGV`-style macros [#161](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/161)
|
||||
@@ -443,6 +515,7 @@ Other:
|
||||
* Guard around `dispatch_resume()` being called with null pointer [#107](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/107)
|
||||
* `NULL` safety checks [#107](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/107)
|
||||
|
||||
|
||||
## [1.6.2 on Apr 2nd, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6.2)
|
||||
|
||||
## [1.6.1 on Apr 2nd, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6.1)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
|
||||
s.name = 'CocoaLumberjack'
|
||||
s.version = '3.7.0'
|
||||
s.version = '3.7.2'
|
||||
s.license = 'BSD'
|
||||
s.summary = 'A fast & simple, yet powerful & flexible logging framework for macOS, iOS, tvOS and watchOS.'
|
||||
s.homepage = 'https://github.com/CocoaLumberjack/CocoaLumberjack'
|
||||
|
||||
@@ -200,7 +200,7 @@ LIBRARY_SEARCH_PATHS = $(inherited)
|
||||
// Code will load on this and later versions of macOS. Framework APIs that are unavailable in earlier versions will be weak-linked; your code should check for null function pointers or specific system versions before calling newer APIs.
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10
|
||||
|
||||
MARKETING_VERSION = 3.7.0
|
||||
MARKETING_VERSION = 3.7.2
|
||||
|
||||
OTHER_C_FLAGS = -Wextra
|
||||
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ let copyrightLines = (
|
||||
source: [
|
||||
"// Software License Agreement (BSD License)",
|
||||
"//",
|
||||
"// Copyright (c) 2010-2020, Deusty, LLC",
|
||||
"// Copyright (c) 2010-2021, Deusty, LLC",
|
||||
"// All rights reserved.",
|
||||
"//",
|
||||
"// Redistribution and use of this software in source and binary forms,",
|
||||
|
||||
+1086
-3838
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 153 KiB |
@@ -33,7 +33,7 @@ Every log message that goes through the Lumberjack framework is turned into a DD
|
||||
@property (readonly, nonatomic) NSString *fileName;
|
||||
@property (readonly, nonatomic) NSString *function;
|
||||
@property (readonly, nonatomic) NSUInteger line;
|
||||
@property (readonly, nonatomic) id tag;
|
||||
@property (readonly, nonatomic) id representedObject;
|
||||
@property (readonly, nonatomic) DDLogMessageOptions options;
|
||||
@property (readonly, nonatomic) NSDate *timestamp;
|
||||
@property (readonly, nonatomic) NSString *threadID; // ID as it appears in NSLog calculated from the machThreadID
|
||||
|
||||
@@ -128,7 +128,7 @@ The DDLogMessage object encapsulates the information about a log message. It is
|
||||
@property (readonly, nonatomic) NSString *fileName;
|
||||
@property (readonly, nonatomic) NSString *function;
|
||||
@property (readonly, nonatomic) NSUInteger line;
|
||||
@property (readonly, nonatomic) id tag;
|
||||
@property (readonly, nonatomic) id representedObject;
|
||||
@property (readonly, nonatomic) DDLogMessageOptions options;
|
||||
@property (readonly, nonatomic) NSDate *timestamp;
|
||||
@property (readonly, nonatomic) NSString *threadID; // ID as it appears in NSLog calculated from the machThreadID
|
||||
|
||||
@@ -7,7 +7,7 @@ When you define your log level, you generally define it in a manner similar to t
|
||||
static const DDLogLevel ddLogLevel = DDLogLevelWarn;
|
||||
```
|
||||
|
||||
What this means is that your log level is declared as a constant. It cannot be changed.\
|
||||
What this means is that your log level is declared as a constant. It cannot be changed.
|
||||
|
||||
This has the advantage that the compiler can automatically prune `DDLog` statements above the log level threshold during compilation. However, it also has the disadvantage that you cannot change your log level during run-time.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2010-2020, Deusty, LLC
|
||||
Copyright (c) 2010-2021, Deusty, LLC
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -76,6 +76,10 @@
|
||||
0A26B5C922E0812F004EE6A7 /* DDMultiFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A26B55022DE346B004EE6A7 /* DDMultiFormatter.m */; };
|
||||
0A26B5CA22E08131004EE6A7 /* CLIColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A26B54B22DE346B004EE6A7 /* CLIColor.m */; };
|
||||
4CFE77952439202B0068D7C6 /* DDLog+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CFE77942439202B0068D7C6 /* DDLog+Combine.swift */; };
|
||||
C711A1902619FA400083F87C /* DDContextFilterLogFormatter+Deprecated.h in Copy Files */ = {isa = PBXBuildFile; fileRef = C76CFC752619ECF100949045 /* DDContextFilterLogFormatter+Deprecated.h */; };
|
||||
C76CFC6A2619EC8900949045 /* DDContextFilterLogFormatter+Deprecated.m in Sources */ = {isa = PBXBuildFile; fileRef = C76CFC682619EC8900949045 /* DDContextFilterLogFormatter+Deprecated.m */; };
|
||||
C76CFC6B2619EC8900949045 /* DDContextFilterLogFormatter+Deprecated.m in Sources */ = {isa = PBXBuildFile; fileRef = C76CFC682619EC8900949045 /* DDContextFilterLogFormatter+Deprecated.m */; };
|
||||
C76CFC762619ECF100949045 /* DDContextFilterLogFormatter+Deprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = C76CFC752619ECF100949045 /* DDContextFilterLogFormatter+Deprecated.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
E43636411F2F0D7100BE80CF /* CocoaLumberjack.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19FF46021B8B4CF400B43179 /* CocoaLumberjack.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@@ -96,6 +100,7 @@
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
C711A1902619FA400083F87C /* DDContextFilterLogFormatter+Deprecated.h in Copy Files */,
|
||||
071909ED243CA055001C431F /* CLIColor.h in Copy Files */,
|
||||
071909EE243CA055001C431F /* DDAbstractDatabaseLogger.h in Copy Files */,
|
||||
071909EF243CA055001C431F /* DDASLLogCapture.h in Copy Files */,
|
||||
@@ -167,6 +172,8 @@
|
||||
435F03AB2174A39200A86B2D /* Module-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Module-Debug.xcconfig"; sourceTree = "<group>"; };
|
||||
435F03AC2174A39200A86B2D /* Module-Shared.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Module-Shared.xcconfig"; sourceTree = "<group>"; };
|
||||
4CFE77942439202B0068D7C6 /* DDLog+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DDLog+Combine.swift"; sourceTree = "<group>"; };
|
||||
C76CFC682619EC8900949045 /* DDContextFilterLogFormatter+Deprecated.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDContextFilterLogFormatter+Deprecated.m"; sourceTree = "<group>"; };
|
||||
C76CFC752619ECF100949045 /* DDContextFilterLogFormatter+Deprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DDContextFilterLogFormatter+Deprecated.h"; sourceTree = "<group>"; };
|
||||
DCB3185914EB418E001CFBEE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@@ -205,6 +212,7 @@
|
||||
071909DC243C9FF8001C431F /* DDASLLogger.h */,
|
||||
071909D6243C9FF8001C431F /* DDAssertMacros.h */,
|
||||
071909D4243C9FF8001C431F /* DDContextFilterLogFormatter.h */,
|
||||
C76CFC752619ECF100949045 /* DDContextFilterLogFormatter+Deprecated.h */,
|
||||
071909D8243C9FF8001C431F /* DDDispatchQueueLogFormatter.h */,
|
||||
071909D3243C9FF8001C431F /* DDFileLogger.h */,
|
||||
071909D7243C9FF8001C431F /* DDFileLogger+Buffering.h */,
|
||||
@@ -268,6 +276,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0A26B54D22DE346B004EE6A7 /* DDContextFilterLogFormatter.m */,
|
||||
C76CFC682619EC8900949045 /* DDContextFilterLogFormatter+Deprecated.m */,
|
||||
0A26B54E22DE346B004EE6A7 /* DDDispatchQueueLogFormatter.m */,
|
||||
0A26B54F22DE346B004EE6A7 /* DDFileLogger+Buffering.m */,
|
||||
0A26B55022DE346B004EE6A7 /* DDMultiFormatter.m */,
|
||||
@@ -363,6 +372,7 @@
|
||||
071909E5243C9FFC001C431F /* DDTTYLogger.h in Headers */,
|
||||
071909E2243C9FFC001C431F /* DDASLLogCapture.h in Headers */,
|
||||
071909E8243C9FFC001C431F /* DDDispatchQueueLogFormatter.h in Headers */,
|
||||
C76CFC762619ECF100949045 /* DDContextFilterLogFormatter+Deprecated.h in Headers */,
|
||||
071909EC243C9FFC001C431F /* DDASLLogger.h in Headers */,
|
||||
071909E4243C9FFC001C431F /* DDContextFilterLogFormatter.h in Headers */,
|
||||
071909DE243C9FFC001C431F /* DDMultiFormatter.h in Headers */,
|
||||
@@ -455,7 +465,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0710;
|
||||
LastUpgradeCheck = 1200;
|
||||
LastUpgradeCheck = 1250;
|
||||
TargetAttributes = {
|
||||
18F3BFD61A81E06E00692297 = {
|
||||
CreatedOnToolsVersion = 6.1.1;
|
||||
@@ -525,6 +535,7 @@
|
||||
0A26B57F22DE34AE004EE6A7 /* DDLog.m in Sources */,
|
||||
0A26B56722DE346B004EE6A7 /* DDFileLogger+Buffering.m in Sources */,
|
||||
0A26B56822DE346B004EE6A7 /* DDMultiFormatter.m in Sources */,
|
||||
C76CFC6A2619EC8900949045 /* DDContextFilterLogFormatter+Deprecated.m in Sources */,
|
||||
0A26B56622DE346B004EE6A7 /* DDDispatchQueueLogFormatter.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -545,6 +556,7 @@
|
||||
0A26B5C822E0812F004EE6A7 /* DDFileLogger+Buffering.m in Sources */,
|
||||
0A26B5C722E0812F004EE6A7 /* DDDispatchQueueLogFormatter.m in Sources */,
|
||||
0A26B5B222DE3700004EE6A7 /* DDAbstractDatabaseLogger.m in Sources */,
|
||||
C76CFC6B2619EC8900949045 /* DDContextFilterLogFormatter+Deprecated.m in Sources */,
|
||||
0A26B5B422DE3700004EE6A7 /* DDASLLogger.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1200"
|
||||
LastUpgradeVersion = "1250"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1200"
|
||||
LastUpgradeVersion = "1250"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1200"
|
||||
LastUpgradeVersion = "1250"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
+73
-27
@@ -15,12 +15,12 @@ CocoaLumberjack
|
||||
|
||||
**CocoaLumberjack** is a fast & simple, yet powerful & flexible logging framework for macOS, iOS, tvOS and watchOS.
|
||||
|
||||
### How to get started
|
||||
## How to get started
|
||||
|
||||
First, install CocoaLumberjack via [CocoaPods](http://cocoapods.org), [Carthage](https://github.com/Carthage/Carthage), [Swift Package Manager](https://swift.org/package-manager/) or manually.
|
||||
Then use `DDOSLogger` for iOS 10 and later, or `DDTTYLogger` and `DDASLLogger` for earlier versions to begin logging messages.
|
||||
|
||||
#### CocoaPods
|
||||
### CocoaPods
|
||||
|
||||
```ruby
|
||||
platform :ios, '9.0'
|
||||
@@ -42,7 +42,7 @@ target 'SampleTarget' do
|
||||
end
|
||||
```
|
||||
|
||||
#### Carthage
|
||||
### Carthage
|
||||
|
||||
Carthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods.
|
||||
|
||||
@@ -54,7 +54,7 @@ github "CocoaLumberjack/CocoaLumberjack"
|
||||
```
|
||||
|
||||
|
||||
#### Swift Package Manager
|
||||
### Swift Package Manager
|
||||
|
||||
As of CocoaLumberjack 3.6.0, you can use the Swift Package Manager as integration method.
|
||||
If you want to use the Swift Package Manager as integration method, either use Xcode to add the package dependency or add the following dependency to your Package.swift:
|
||||
@@ -65,11 +65,11 @@ If you want to use the Swift Package Manager as integration method, either use X
|
||||
|
||||
Note that you may need to add both products, `CocoaLumberjack` and `CocoaLumberjackSwift` to your target since SPM sometimes fails to detect that `CocoaLumerjackSwift` depends on `CocoaLumberjack`.
|
||||
|
||||
#### Install manually
|
||||
### Install manually
|
||||
|
||||
If you want to install CocoaLumberjack manually, read the [manual installation](https://raw.githubusercontent.com/CocoaLumberjack/CocoaLumberjack/master/Documentation/GettingStarted.md#manual-installation) guide for more information.
|
||||
|
||||
#### Swift Usage
|
||||
### Swift Usage
|
||||
|
||||
Usually, you can simply `import CocoaLumberjackSwift`. If you installed CocoaLumberjack using CocoaPods, you need to use `import CocoaLumberjack` instead.
|
||||
|
||||
@@ -90,7 +90,7 @@ DDLogWarn("Warn")
|
||||
DDLogError("Error")
|
||||
```
|
||||
|
||||
#### Obj-C usage
|
||||
### Obj-C usage
|
||||
|
||||
If you're using Lumberjack as a framework, you can `@import CocoaLumberjack;`.
|
||||
Otherwise, `#import <CocoaLumberjack/CocoaLumberjack.h>`
|
||||
@@ -111,9 +111,13 @@ DDLogInfo(@"Info");
|
||||
DDLogWarn(@"Warn");
|
||||
DDLogError(@"Error");
|
||||
```
|
||||
### Objective-C ARC Semantic Issue
|
||||
|
||||
When integrating Lumberjack into an existing Objective-C it is possible to run into `Multiple methods named 'tag' found with mismatched result, parameter type or attributes` build error.
|
||||
|
||||
### [swift-log](https://github.com/apple/swift-log) backend
|
||||
Add `#define DD_LEGACY_MESSAGE_TAG 0` before importing CocoaLumberjack or add `#define DD_LEGACY_MESSAGE_TAG 0` or add `-DDD_LEGACY_MESSAGE_TAG=0` to *Other C Flags*/*OTHER_CFLAGS* in your Xcode project.
|
||||
|
||||
## [swift-log](https://github.com/apple/swift-log) backend
|
||||
|
||||
CocoaLumberjack also ships with a backend implementation for [swift-log](https://github.com/apple/swift-log).
|
||||
Simply add CocoaLumberjack as dependency to your SPM target (see above) and also add the `CocoaLumberjackSwiftLogBackend` product as dependency to your target.
|
||||
@@ -123,49 +127,49 @@ You can then use `DDLogHandler` as backend for swift-log, which will forward all
|
||||
In your own log formatters, you can make use of the `swiftLogInfo` property on `DDLogMessage` to retrieve the details of a message that is logged via swift-log.
|
||||
|
||||
|
||||
#### More information
|
||||
### More information
|
||||
|
||||
- read the [Getting started](https://raw.githubusercontent.com/CocoaLumberjack/CocoaLumberjack/master/Documentation/GettingStarted.md) guide, check out the [FAQ](https://raw.githubusercontent.com/CocoaLumberjack/CocoaLumberjack/master/Documentation/FAQ.md) section or the other [docs](Documentation/)
|
||||
- if you find issues or want to suggest improvements, create an issue or a pull request
|
||||
- for all kinds of questions involving CocoaLumberjack, use the [Google group](http://groups.google.com/group/cocoalumberjack) or StackOverflow (use [#lumberjack](http://stackoverflow.com/questions/tagged/lumberjack)).
|
||||
|
||||
|
||||
### CocoaLumberjack 3
|
||||
## CocoaLumberjack 3
|
||||
|
||||
#### Migrating to 3.x
|
||||
### Migrating to 3.x
|
||||
|
||||
* To be determined
|
||||
|
||||
### Features
|
||||
## Features
|
||||
|
||||
#### Lumberjack is Fast & Simple, yet Powerful & Flexible.
|
||||
### Lumberjack is Fast & Simple, yet Powerful & Flexible.
|
||||
|
||||
It is similar in concept to other popular logging frameworks such as log4j, yet is designed specifically for Objective-C, and takes advantage of features such as multi-threading, grand central dispatch (if available), lockless atomic operations, and the dynamic nature of the Objective-C runtime.
|
||||
|
||||
#### Lumberjack is Fast
|
||||
### Lumberjack is Fast
|
||||
|
||||
In most cases it is an order of magnitude faster than NSLog.
|
||||
|
||||
#### Lumberjack is Simple
|
||||
### Lumberjack is Simple
|
||||
|
||||
It takes as little as a single line of code to configure lumberjack when your application launches. Then simply replace your NSLog statements with DDLog statements and that's about it. (And the DDLog macros have the exact same format and syntax as NSLog, so it's super easy.)
|
||||
|
||||
#### Lumberjack is Powerful:
|
||||
### Lumberjack is Powerful:
|
||||
|
||||
One log statement can be sent to multiple loggers, meaning you can log to a file and the console simultaneously. Want more? Create your own loggers (it's easy) and send your log statements over the network. Or to a database or distributed file system. The sky is the limit.
|
||||
|
||||
#### Lumberjack is Flexible:
|
||||
### Lumberjack is Flexible:
|
||||
|
||||
Configure your logging however you want. Change log levels per file (perfect for debugging). Change log levels per logger (verbose console, but concise log file). Change log levels per xcode configuration (verbose debug, but concise release). Have your log statements compiled out of the release build. Customize the number of log levels for your application. Add your own fine-grained logging. Dynamically change log levels during runtime. Choose how & when you want your log files to be rolled. Upload your log files to a central server. Compress archived log files to save disk space...
|
||||
|
||||
### This framework is for you if:
|
||||
## This framework is for you if:
|
||||
|
||||
- You're looking for a way to track down that impossible-to-reproduce bug that keeps popping up in the field.
|
||||
- You're frustrated with the super short console log on the iPhone.
|
||||
- You're looking to take your application to the next level in terms of support and stability.
|
||||
- You're looking for an enterprise level logging solution for your application (Mac or iPhone).
|
||||
|
||||
### Documentation
|
||||
## Documentation
|
||||
|
||||
- **[Get started using Lumberjack](https://github.com/CocoaLumberjack/CocoaLumberjack/blob/master/Documentation/GettingStarted.md)**<br/>
|
||||
- [Different log levels for Debug and Release builds](https://github.com/CocoaLumberjack/CocoaLumberjack/blob/master/Documentation/XcodeTricks.md)<br/>
|
||||
@@ -178,7 +182,7 @@ Configure your logging however you want. Change log levels per file (perfect for
|
||||
- [AppCode support](https://github.com/CocoaLumberjack/CocoaLumberjack/blob/master/Documentation/AppCode-support.md)
|
||||
- **[Full Lumberjack documentation](Documentation/)**<br/>
|
||||
|
||||
### Requirements
|
||||
## Requirements
|
||||
The current version of Lumberjack requires:
|
||||
- Xcode 12 or later
|
||||
- Swift 5.3 or later
|
||||
@@ -187,7 +191,7 @@ The current version of Lumberjack requires:
|
||||
- watchOS 3 or later
|
||||
- tvOS 9 or later
|
||||
|
||||
#### Backwards compatibility
|
||||
### Backwards compatibility
|
||||
- for Xcode 11 and Swift up to 5.2, use the 3.6.2 version
|
||||
- for Xcode 10 and Swift 4.2, use the 3.5.2 version
|
||||
- for iOS 8, use the 3.6.1 version
|
||||
@@ -201,7 +205,7 @@ The current version of Lumberjack requires:
|
||||
- for Xcode 6 or earlier, use the 2.0.x version
|
||||
- for OS X < 10.7 support, use the 1.6.0 version
|
||||
|
||||
### Communication
|
||||
## Communication
|
||||
|
||||
- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/lumberjack). (Tag 'lumberjack')
|
||||
- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/lumberjack).
|
||||
@@ -209,11 +213,53 @@ The current version of Lumberjack requires:
|
||||
- If you **have a feature request**, open an issue.
|
||||
- If you **want to contribute**, submit a pull request.
|
||||
|
||||
### Author
|
||||
## Data Collection Practices
|
||||
|
||||
Per [App privacy details on the App Store](https://developer.apple.com/app-store/app-privacy-details/), Apple is requesting app developers to provide info about their data collection, us SDK maintainers must provide them with the same data.
|
||||
|
||||
### Data collection by the framework
|
||||
|
||||
**By default, CocoaLumberjack does NOT collect any data on its own.**
|
||||
|
||||
[See our Data Collection Practices list.](https://cocoalumberjack.github.io/DataCollection/index.html)
|
||||
|
||||
### Indirect data collection through the framework
|
||||
|
||||
CocoaLumberjack is a logging framework which makes it easy to send those logs to different platforms.
|
||||
|
||||
This is why collecting data might happen quite easily, if app developers include any sensitive data into their log messages.
|
||||
|
||||
**Important note: app developers are fully responsible for any sensitive data collected through our logging system!**
|
||||
|
||||
In consequence, you must comply to the Apple's privacy details policy (mentioned above) and document the ways in which user data is being collected.
|
||||
Since the number of scenarios where data might be indirectly collected through CocoaLumberjack is quite large, it's up to you, as app developers, to properly review your app's code and identify those cases.
|
||||
What we can do to help is raise awareness about potential data collection through our framework.
|
||||
|
||||
Private data includes but isn't limited to:
|
||||
|
||||
- user info (name, email, address, ...)
|
||||
- location info
|
||||
- contacts
|
||||
- identifiers (user id, device id, ...)
|
||||
- app usage data
|
||||
- performance data
|
||||
- health and fitness info
|
||||
- financial info
|
||||
- sensitive info
|
||||
- user content
|
||||
- history (browsing, search, ...)
|
||||
- purchases
|
||||
- diagnostics
|
||||
- ...
|
||||
|
||||
_Example_: `DDLogInfo("User: \(myUser)")` will add the `myUser` info to the logs, so if those are forwarded to a 3rd party or sent via email, that may qualify as data collection.
|
||||
|
||||
## Author
|
||||
|
||||
- [Robbie Hanson](https://github.com/robbiehanson)
|
||||
- Love the project? Wanna buy me a coffee? (or a beer :D) [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UZRA26JPJB3DA)
|
||||
|
||||
### Collaborators
|
||||
## Collaborators
|
||||
- [Ernesto Rivera](https://github.com/rivera-ernesto)
|
||||
- [Dmitry Vorobyov](https://github.com/dvor)
|
||||
- [Bogdan Poplauschi](https://github.com/bpoplauschi)
|
||||
@@ -226,14 +272,14 @@ The current version of Lumberjack requires:
|
||||
- [Dmitry Lobanov](https://github.com/lolgear)
|
||||
- [Hakon Hanesand](https://github.com/hhanesand)
|
||||
|
||||
### License
|
||||
## License
|
||||
- CocoaLumberjack is available under the BSD 3 license. See the [LICENSE file](https://github.com/CocoaLumberjack/CocoaLumberjack/blob/master/LICENSE).
|
||||
|
||||
### Extensions
|
||||
## Extensions
|
||||
- [LogIO-CocoaLumberjack](https://github.com/s4nchez/LogIO-CocoaLumberjack) A log.io logger for CocoaLumberjack
|
||||
- [XCDLumberjackNSLogger](https://github.com/0xced/XCDLumberjackNSLogger) CocoaLumberjack logger which sends logs to NSLogger
|
||||
|
||||
### Architecture
|
||||
## Architecture
|
||||
|
||||
<p align="center" >
|
||||
<img src="https://raw.githubusercontent.com/CocoaLumberjack/CocoaLumberjack/master/Documentation/CocoaLumberjackClassDiagram.png" title="CocoaLumberjack class diagram">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -13,6 +13,8 @@
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
|
||||
#import <CocoaLumberjack/CLIColor.h>
|
||||
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -13,6 +13,8 @@
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
#if !TARGET_OS_WATCH
|
||||
|
||||
#include <asl.h>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -13,6 +13,8 @@
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
#if !TARGET_OS_WATCH
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+116
-76
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -71,14 +71,6 @@ NSTimeInterval const kDDRollingLeeway = 1.0; // 1s
|
||||
@synthesize maximumNumberOfLogFiles = _maximumNumberOfLogFiles;
|
||||
@synthesize logFilesDiskQuota = _logFilesDiskQuota;
|
||||
|
||||
+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)theKey {
|
||||
if ([theKey isEqualToString:@"maximumNumberOfLogFiles"] || [theKey isEqualToString:@"logFilesDiskQuota"]) {
|
||||
return NO;
|
||||
} else {
|
||||
return [super automaticallyNotifiesObserversForKey:theKey];
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
return [self initWithLogsDirectory:nil];
|
||||
}
|
||||
@@ -99,11 +91,6 @@ NSTimeInterval const kDDRollingLeeway = 1.0; // 1s
|
||||
_logsDirectory = [[self defaultLogsDirectory] copy];
|
||||
}
|
||||
|
||||
NSKeyValueObservingOptions kvoOptions = NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew;
|
||||
|
||||
[self addObserver:self forKeyPath:NSStringFromSelector(@selector(maximumNumberOfLogFiles)) options:kvoOptions context:nil];
|
||||
[self addObserver:self forKeyPath:NSStringFromSelector(@selector(logFilesDiskQuota)) options:kvoOptions context:nil];
|
||||
|
||||
NSLogVerbose(@"DDFileLogManagerDefault: logsDirectory:\n%@", [self logsDirectory]);
|
||||
NSLogVerbose(@"DDFileLogManagerDefault: sortedLogFileNames:\n%@", [self sortedLogFileNames]);
|
||||
}
|
||||
@@ -129,40 +116,28 @@ NSTimeInterval const kDDRollingLeeway = 1.0; // 1s
|
||||
|
||||
#endif
|
||||
|
||||
- (void)dealloc {
|
||||
// try-catch because the observer might be removed or never added. In this case, removeObserver throws an exception
|
||||
@try {
|
||||
[self removeObserver:self forKeyPath:NSStringFromSelector(@selector(maximumNumberOfLogFiles))];
|
||||
[self removeObserver:self forKeyPath:NSStringFromSelector(@selector(logFilesDiskQuota))];
|
||||
} @catch (NSException *exception) {
|
||||
- (void)deleteOldFilesForConfigurationChange {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
@autoreleasepool {
|
||||
// See method header for queue reasoning.
|
||||
[self deleteOldLogFiles];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)setLogFilesDiskQuota:(unsigned long long)logFilesDiskQuota {
|
||||
if (_logFilesDiskQuota != logFilesDiskQuota) {
|
||||
_logFilesDiskQuota = logFilesDiskQuota;
|
||||
NSLogInfo(@"DDFileLogManagerDefault: Responding to configuration change: logFilesDiskQuota");
|
||||
[self deleteOldFilesForConfigurationChange];
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark Configuration
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath
|
||||
ofObject:(__unused id)object
|
||||
change:(NSDictionary *)change
|
||||
context:(__unused void *)context {
|
||||
NSNumber *old = change[NSKeyValueChangeOldKey];
|
||||
NSNumber *new = change[NSKeyValueChangeNewKey];
|
||||
|
||||
if ([old isEqual:new]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ([keyPath isEqualToString:NSStringFromSelector(@selector(maximumNumberOfLogFiles))] ||
|
||||
[keyPath isEqualToString:NSStringFromSelector(@selector(logFilesDiskQuota))]) {
|
||||
NSLogInfo(@"DDFileLogManagerDefault: Responding to configuration change: %@", keyPath);
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
@autoreleasepool {
|
||||
// See method header for queue reasoning.
|
||||
[self deleteOldLogFiles];
|
||||
}
|
||||
});
|
||||
- (void)setMaximumNumberOfLogFiles:(NSUInteger)maximumNumberOfLogFiles {
|
||||
if (_maximumNumberOfLogFiles != maximumNumberOfLogFiles) {
|
||||
_maximumNumberOfLogFiles = maximumNumberOfLogFiles;
|
||||
NSLogInfo(@"DDFileLogManagerDefault: Responding to configuration change: maximumNumberOfLogFiles");
|
||||
[self deleteOldFilesForConfigurationChange];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,9 +625,21 @@ NSTimeInterval const kDDRollingLeeway = 1.0; // 1s
|
||||
- (void)lt_cleanup {
|
||||
NSAssert([self isOnInternalLoggerQueue], @"lt_ methods should be on logger queue.");
|
||||
|
||||
[_currentLogFileHandle synchronizeFile];
|
||||
[_currentLogFileHandle closeFile];
|
||||
|
||||
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {
|
||||
__autoreleasing NSError *error;
|
||||
BOOL synchronized = [_currentLogFileHandle synchronizeAndReturnError:&error];
|
||||
if (!synchronized) {
|
||||
NSLogError(@"DDFileLogger: Failed to synchronize file: %@", error);
|
||||
}
|
||||
BOOL closed = [_currentLogFileHandle closeAndReturnError:&error];
|
||||
if (!closed) {
|
||||
NSLogError(@"DDFileLogger: Failed to close file: %@", error);
|
||||
}
|
||||
} else {
|
||||
[_currentLogFileHandle synchronizeFile];
|
||||
[_currentLogFileHandle closeFile];
|
||||
}
|
||||
|
||||
if (_currentLogFileVnode) {
|
||||
dispatch_source_cancel(_currentLogFileVnode);
|
||||
_currentLogFileVnode = NULL;
|
||||
@@ -885,9 +872,21 @@ NSTimeInterval const kDDRollingLeeway = 1.0; // 1s
|
||||
if (_currentLogFileHandle == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
[_currentLogFileHandle synchronizeFile];
|
||||
[_currentLogFileHandle closeFile];
|
||||
|
||||
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {
|
||||
__autoreleasing NSError *error;
|
||||
BOOL synchronized = [_currentLogFileHandle synchronizeAndReturnError:&error];
|
||||
if (!synchronized) {
|
||||
NSLogError(@"DDFileLogger: Failed to synchronize file: %@", error);
|
||||
}
|
||||
BOOL closed = [_currentLogFileHandle closeAndReturnError:&error];
|
||||
if (!closed) {
|
||||
NSLogError(@"DDFileLogger: Failed to close file: %@", error);
|
||||
}
|
||||
} else {
|
||||
[_currentLogFileHandle synchronizeFile];
|
||||
[_currentLogFileHandle closeFile];
|
||||
}
|
||||
_currentLogFileHandle = nil;
|
||||
|
||||
_currentLogFileInfo.isArchived = YES;
|
||||
@@ -947,7 +946,17 @@ NSTimeInterval const kDDRollingLeeway = 1.0; // 1s
|
||||
// We specifically wrote our own getter/setter method to allow us to do this (for performance reasons).
|
||||
|
||||
if (_maximumFileSize > 0) {
|
||||
unsigned long long fileSize = [_currentLogFileHandle offsetInFile];
|
||||
unsigned long long fileSize;
|
||||
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {
|
||||
__autoreleasing NSError *error;
|
||||
BOOL succeed = [_currentLogFileHandle getOffset:&fileSize error:&error];
|
||||
if (!succeed) {
|
||||
NSLogError(@"DDFileLogger: Failed to get offset: %@", error);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
fileSize = [_currentLogFileHandle offsetInFile];
|
||||
}
|
||||
|
||||
if (fileSize >= _maximumFileSize) {
|
||||
NSLogVerbose(@"DDFileLogger: Rolling log file due to size (%qu)...", fileSize);
|
||||
@@ -964,9 +973,7 @@ NSTimeInterval const kDDRollingLeeway = 1.0; // 1s
|
||||
- (BOOL)lt_shouldLogFileBeArchived:(DDLogFileInfo *)mostRecentLogFileInfo {
|
||||
NSAssert([self isOnInternalLoggerQueue], @"lt_ methods should be on logger queue.");
|
||||
|
||||
if (mostRecentLogFileInfo.isArchived) {
|
||||
return NO;
|
||||
} else if ([self shouldArchiveRecentLogFileInfo:mostRecentLogFileInfo]) {
|
||||
if ([self shouldArchiveRecentLogFileInfo:mostRecentLogFileInfo]) {
|
||||
return YES;
|
||||
} else if (_maximumFileSize > 0 && mostRecentLogFileInfo.fileSize >= _maximumFileSize) {
|
||||
return YES;
|
||||
@@ -984,7 +991,7 @@ NSTimeInterval const kDDRollingLeeway = 1.0; // 1s
|
||||
// If previous log was created when app wasn't running in background, but now it is - we archive it and create
|
||||
// a new one.
|
||||
//
|
||||
// If user has overwritten to NSFileProtectionNone there is no neeed to create a new one.
|
||||
// If user has overwritten to NSFileProtectionNone there is no need to create a new one.
|
||||
if (doesAppRunInBackground()) {
|
||||
NSFileProtectionType key = mostRecentLogFileInfo.fileAttributes[NSFileProtectionKey];
|
||||
BOOL isUntilFirstAuth = [key isEqualToString:NSFileProtectionCompleteUntilFirstUserAuthentication];
|
||||
@@ -1113,11 +1120,10 @@ NSTimeInterval const kDDRollingLeeway = 1.0; // 1s
|
||||
NSAssert([self isOnInternalLoggerQueue], @"lt_ methods should be on logger queue.");
|
||||
NSAssert(_currentLogFileHandle, @"Can not monitor without handle.");
|
||||
|
||||
dispatch_source_vnode_flags_t flags = DISPATCH_VNODE_DELETE | DISPATCH_VNODE_RENAME | DISPATCH_VNODE_REVOKE;
|
||||
_currentLogFileVnode = dispatch_source_create(DISPATCH_SOURCE_TYPE_VNODE,
|
||||
(uintptr_t)[_currentLogFileHandle fileDescriptor],
|
||||
flags,
|
||||
_loggerQueue);
|
||||
(uintptr_t)[_currentLogFileHandle fileDescriptor],
|
||||
DISPATCH_VNODE_DELETE | DISPATCH_VNODE_RENAME | DISPATCH_VNODE_REVOKE,
|
||||
_loggerQueue);
|
||||
|
||||
__weak __auto_type weakSelf = self;
|
||||
dispatch_source_set_event_handler(_currentLogFileVnode, ^{ @autoreleasepool {
|
||||
@@ -1132,10 +1138,11 @@ NSTimeInterval const kDDRollingLeeway = 1.0; // 1s
|
||||
});
|
||||
#endif
|
||||
|
||||
if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *))
|
||||
if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)) {
|
||||
dispatch_activate(_currentLogFileVnode);
|
||||
else
|
||||
} else {
|
||||
dispatch_resume(_currentLogFileVnode);
|
||||
}
|
||||
}
|
||||
|
||||
- (NSFileHandle *)lt_currentLogFileHandle {
|
||||
@@ -1144,7 +1151,15 @@ NSTimeInterval const kDDRollingLeeway = 1.0; // 1s
|
||||
if (!_currentLogFileHandle) {
|
||||
NSString *logFilePath = [[self lt_currentLogFileInfo] filePath];
|
||||
_currentLogFileHandle = [NSFileHandle fileHandleForWritingAtPath:logFilePath];
|
||||
[_currentLogFileHandle seekToEndOfFile];
|
||||
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {
|
||||
__autoreleasing NSError *error;
|
||||
BOOL succeed = [_currentLogFileHandle seekToEndReturningOffset:nil error:&error];
|
||||
if (!succeed) {
|
||||
NSLogError(@"DDFileLogger: Failed to seek to end of file: %@", error);
|
||||
}
|
||||
} else {
|
||||
[_currentLogFileHandle seekToEndOfFile];
|
||||
}
|
||||
|
||||
if (_currentLogFileHandle) {
|
||||
[self lt_scheduleTimerToRollLogFileDueToAge];
|
||||
@@ -1172,9 +1187,7 @@ static int exception_count = 0;
|
||||
[self lt_logData:data];
|
||||
}
|
||||
|
||||
- (void)willLogMessage:(DDLogFileInfo *)logFileInfo {
|
||||
|
||||
}
|
||||
- (void)willLogMessage:(DDLogFileInfo *)logFileInfo {}
|
||||
|
||||
- (void)didLogMessage:(DDLogFileInfo *)logFileInfo {
|
||||
[self lt_maybeRollLogFileDueToSize];
|
||||
@@ -1215,7 +1228,15 @@ static int exception_count = 0;
|
||||
|
||||
- (void)lt_flush {
|
||||
NSAssert([self isOnInternalLoggerQueue], @"flush should only be executed on internal queue.");
|
||||
[_currentLogFileHandle synchronizeFile];
|
||||
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {
|
||||
__autoreleasing NSError *error;
|
||||
BOOL succeed = [_currentLogFileHandle synchronizeAndReturnError:&error];
|
||||
if (!succeed) {
|
||||
NSLogError(@"DDFileLogger: Failed to synchronize file: %@", error);
|
||||
}
|
||||
} else {
|
||||
[_currentLogFileHandle synchronizeFile];
|
||||
}
|
||||
}
|
||||
|
||||
- (DDLoggerName)loggerName {
|
||||
@@ -1251,19 +1272,19 @@ static int exception_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dummyMethod {}
|
||||
- (void)lt_deprecationCatchAll {}
|
||||
|
||||
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector {
|
||||
if (aSelector == @selector(willLogMessage) || aSelector == @selector(didLogMessage)) {
|
||||
// Ignore calls to deprecated methods.
|
||||
return [self methodSignatureForSelector:@selector(dummyMethod)];
|
||||
return [self methodSignatureForSelector:@selector(lt_deprecationCatchAll)];
|
||||
}
|
||||
|
||||
return [super methodSignatureForSelector:aSelector];
|
||||
}
|
||||
|
||||
- (void)forwardInvocation:(NSInvocation *)anInvocation {
|
||||
if (anInvocation.selector != @selector(dummyMethod)) {
|
||||
if (anInvocation.selector != @selector(lt_deprecationCatchAll)) {
|
||||
[super forwardInvocation:anInvocation];
|
||||
}
|
||||
}
|
||||
@@ -1295,8 +1316,20 @@ static int exception_count = 0;
|
||||
}
|
||||
|
||||
NSFileHandle *handle = [self lt_currentLogFileHandle];
|
||||
[handle seekToEndOfFile];
|
||||
[handle writeData:data];
|
||||
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {
|
||||
__autoreleasing NSError *error;
|
||||
BOOL sought = [handle seekToEndReturningOffset:nil error:&error];
|
||||
if (!sought) {
|
||||
NSLogError(@"DDFileLogger: Failed to seek to end of file: %@", error);
|
||||
}
|
||||
BOOL written = [handle writeData:data error:&error];
|
||||
if (!written) {
|
||||
NSLogError(@"DDFileLogger: Failed to write data: %@", error);
|
||||
}
|
||||
} else {
|
||||
[handle seekToEndOfFile];
|
||||
[handle writeData:data];
|
||||
}
|
||||
|
||||
if (implementsDeprecatedDidLog) {
|
||||
#pragma clang diagnostic push
|
||||
@@ -1672,10 +1705,17 @@ static NSString *_xattrToExtensionName(NSString *attrName) {
|
||||
int result = setxattr(path, name, "\1", 1, 0, 0);
|
||||
|
||||
if (result < 0) {
|
||||
NSLogError(@"DDLogFileInfo: setxattr(%@, %@): error = %s",
|
||||
attrName,
|
||||
filePath,
|
||||
strerror(errno));
|
||||
if (errno != ENOENT) {
|
||||
NSLogError(@"DDLogFileInfo: setxattr(%@, %@): error = %s",
|
||||
attrName,
|
||||
filePath,
|
||||
strerror(errno));
|
||||
} else {
|
||||
NSLogDebug(@"DDLogFileInfo: File does not exist in setxattr(%@, %@): error = %s",
|
||||
attrName,
|
||||
filePath,
|
||||
strerror(errno));
|
||||
}
|
||||
}
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -48,21 +48,6 @@
|
||||
|
||||
#define NSLogDebug(frmt, ...) do{ if(DD_DEBUG) NSLog((frmt), ##__VA_ARGS__); } while(0)
|
||||
|
||||
// Specifies the maximum queue size of the logging thread.
|
||||
//
|
||||
// Since most logging is asynchronous, its possible for rogue threads to flood the logging queue.
|
||||
// That is, to issue an abundance of log statements faster than the logging thread can keep up.
|
||||
// Typically such a scenario occurs when log statements are added haphazardly within large loops,
|
||||
// but may also be possible if relatively slow loggers are being used.
|
||||
//
|
||||
// This property caps the queue size at a given number of outstanding log statements.
|
||||
// If a thread attempts to issue a log statement when the queue is already maxed out,
|
||||
// the issuing thread will block until the queue size drops below the max again.
|
||||
|
||||
#ifndef DDLOG_MAX_QUEUE_SIZE
|
||||
#define DDLOG_MAX_QUEUE_SIZE 1000 // Should not exceed INT32_MAX
|
||||
#endif
|
||||
|
||||
// The "global logging queue" refers to [DDLog loggingQueue].
|
||||
// It is the queue that all log statements go through.
|
||||
//
|
||||
@@ -112,10 +97,6 @@ static dispatch_queue_t _loggingQueue;
|
||||
// Each logger has it's own associated queue, and a dispatch group is used for synchronization.
|
||||
static dispatch_group_t _loggingGroup;
|
||||
|
||||
// In order to prevent to queue from growing infinitely large,
|
||||
// a maximum size is enforced (DDLOG_MAX_QUEUE_SIZE).
|
||||
static dispatch_semaphore_t _queueSemaphore;
|
||||
|
||||
// Minor optimization for uniprocessor machines
|
||||
static NSUInteger _numProcessors;
|
||||
|
||||
@@ -156,8 +137,6 @@ static NSUInteger _numProcessors;
|
||||
void *nonNullValue = GlobalLoggingQueueIdentityKey; // Whatever, just not null
|
||||
dispatch_queue_set_specific(_loggingQueue, GlobalLoggingQueueIdentityKey, nonNullValue, NULL);
|
||||
|
||||
_queueSemaphore = dispatch_semaphore_create(DDLOG_MAX_QUEUE_SIZE);
|
||||
|
||||
// Figure out how many processors are available.
|
||||
// This may be used later for an optimization on uniprocessor machines.
|
||||
|
||||
@@ -338,19 +317,7 @@ static NSUInteger _numProcessors;
|
||||
// Now assume we have another separate thread that attempts to issue log message G.
|
||||
// It should block until log messages A and B have been unqueued.
|
||||
|
||||
|
||||
// We are using a counting semaphore provided by GCD.
|
||||
// The semaphore is initialized with our DDLOG_MAX_QUEUE_SIZE value.
|
||||
// Every time we want to queue a log message we decrement this value.
|
||||
// If the resulting value is less than zero,
|
||||
// the semaphore function waits in FIFO order for a signal to occur before returning.
|
||||
//
|
||||
// A dispatch semaphore is an efficient implementation of a traditional counting semaphore.
|
||||
// Dispatch semaphores call down to the kernel only when the calling thread needs to be blocked.
|
||||
// If the calling semaphore does not need to block, no kernel call is made.
|
||||
|
||||
dispatch_block_t logBlock = ^{
|
||||
dispatch_semaphore_wait(_queueSemaphore, DISPATCH_TIME_FOREVER);
|
||||
// We're now sure we won't overflow the queue.
|
||||
// It is time to queue our log message.
|
||||
@autoreleasepool {
|
||||
@@ -521,6 +488,9 @@ static NSUInteger _numProcessors;
|
||||
}
|
||||
|
||||
- (void)flushLog {
|
||||
NSAssert(!dispatch_get_specific(GlobalLoggingQueueIdentityKey),
|
||||
@"This method shouldn't be run on the logging thread/queue that make flush fast enough");
|
||||
|
||||
dispatch_sync(_loggingQueue, ^{ @autoreleasepool {
|
||||
[self lt_flush];
|
||||
} });
|
||||
@@ -868,22 +838,6 @@ static NSUInteger _numProcessors;
|
||||
} });
|
||||
}
|
||||
}
|
||||
|
||||
// If our queue got too big, there may be blocked threads waiting to add log messages to the queue.
|
||||
// Since we've now dequeued an item from the log, we may need to unblock the next thread.
|
||||
|
||||
// We are using a counting semaphore provided by GCD.
|
||||
// The semaphore is initialized with our DDLOG_MAX_QUEUE_SIZE value.
|
||||
// When a log message is queued this value is decremented.
|
||||
// When a log message is dequeued this value is incremented.
|
||||
// If the value ever drops below zero,
|
||||
// the queueing thread blocks and waits in FIFO order for us to signal it.
|
||||
//
|
||||
// A dispatch semaphore is an efficient implementation of a traditional counting semaphore.
|
||||
// Dispatch semaphores call down to the kernel only when the calling thread needs to be blocked.
|
||||
// If the calling semaphore does not need to block, no kernel call is made.
|
||||
|
||||
dispatch_semaphore_signal(_queueSemaphore);
|
||||
}
|
||||
|
||||
- (void)lt_flush {
|
||||
@@ -1044,7 +998,13 @@ NSString * __nullable DDExtractFileNameWithoutExtension(const char *filePath, BO
|
||||
_function = copyFunction ? [function copy] : function;
|
||||
|
||||
_line = line;
|
||||
_tag = tag;
|
||||
_representedObject = tag;
|
||||
#if DD_LEGACY_MESSAGE_TAG
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
_tag = tag;
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
_options = options;
|
||||
_timestamp = timestamp ?: [NSDate new];
|
||||
|
||||
@@ -1086,7 +1046,7 @@ NSString * __nullable DDExtractFileNameWithoutExtension(const char *filePath, BO
|
||||
&& [otherMsg->_fileName isEqualToString:_fileName]
|
||||
&& [otherMsg->_function isEqualToString:_function]
|
||||
&& otherMsg->_line == _line
|
||||
&& (([otherMsg->_tag respondsToSelector:@selector(isEqual:)] && [otherMsg->_tag isEqual:_tag]) || otherMsg->_tag == _tag)
|
||||
&& (([otherMsg->_representedObject respondsToSelector:@selector(isEqual:)] && [otherMsg->_representedObject isEqual:_representedObject]) || otherMsg->_representedObject == _representedObject)
|
||||
&& otherMsg->_options == _options
|
||||
&& [otherMsg->_timestamp isEqualToDate:_timestamp]
|
||||
&& [otherMsg->_threadID isEqualToString:_threadID] // If the thread ID is the same, the name will likely be the same as well.
|
||||
@@ -1105,7 +1065,7 @@ NSString * __nullable DDExtractFileNameWithoutExtension(const char *filePath, BO
|
||||
^ _fileName.hash
|
||||
^ _function.hash
|
||||
^ _line
|
||||
^ ([_tag respondsToSelector:@selector(hash)] ? [_tag hash] : 0)
|
||||
^ ([_representedObject respondsToSelector:@selector(hash)] ? [_representedObject hash] : 0)
|
||||
^ _options
|
||||
^ _timestamp.hash
|
||||
^ _threadID.hash
|
||||
@@ -1124,7 +1084,13 @@ NSString * __nullable DDExtractFileNameWithoutExtension(const char *filePath, BO
|
||||
newMessage->_fileName = _fileName;
|
||||
newMessage->_function = _function;
|
||||
newMessage->_line = _line;
|
||||
newMessage->_representedObject = _representedObject;
|
||||
#if DD_LEGACY_MESSAGE_TAG
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
newMessage->_tag = _tag;
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
newMessage->_options = _options;
|
||||
newMessage->_timestamp = _timestamp;
|
||||
newMessage->_threadID = _threadID;
|
||||
@@ -1135,6 +1101,11 @@ NSString * __nullable DDExtractFileNameWithoutExtension(const char *filePath, BO
|
||||
return newMessage;
|
||||
}
|
||||
|
||||
// ensure compatibility even when built with DD_LEGACY_MESSAGE_TAG to 0.
|
||||
- (id)tag {
|
||||
return _representedObject;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -1184,8 +1184,8 @@ static DDTTYLogger *sharedInstance;
|
||||
DDTTYLoggerColorProfile *colorProfile = nil;
|
||||
|
||||
if (_colorsEnabled) {
|
||||
if (logMessage->_tag) {
|
||||
colorProfile = _colorProfilesDict[logMessage->_tag];
|
||||
if (logMessage->_representedObject) {
|
||||
colorProfile = _colorProfilesDict[logMessage->_representedObject];
|
||||
}
|
||||
|
||||
if (colorProfile == nil) {
|
||||
@@ -1218,20 +1218,21 @@ static DDTTYLogger *sharedInstance;
|
||||
NSUInteger msgLen = [logMsg lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
const BOOL useStack = msgLen < (1024 * 4);
|
||||
|
||||
char msgStack[useStack ? (msgLen + 1) : 1]; // Analyzer doesn't like zero-size array, hence the 1
|
||||
char *msg = useStack ? msgStack : (char *)calloc(msgLen + 1, sizeof(char));
|
||||
|
||||
char *msg;
|
||||
if (useStack) {
|
||||
msg = (char *)alloca(msgLen + 1);
|
||||
} else {
|
||||
msg = (char *)calloc(msgLen + 1, sizeof(char));
|
||||
}
|
||||
if (msg == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL logMsgEnc = [logMsg getCString:msg maxLength:(msgLen + 1) encoding:NSUTF8StringEncoding];
|
||||
|
||||
if (!logMsgEnc) {
|
||||
if (!useStack && msg != NULL) {
|
||||
if (!useStack) {
|
||||
free(msg);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1239,7 +1240,7 @@ static DDTTYLogger *sharedInstance;
|
||||
|
||||
if (isFormatted) {
|
||||
// The log message has already been formatted.
|
||||
int iovec_len = (_automaticallyAppendNewlineForCustomFormatters) ? 5 : 4;
|
||||
const int iovec_len = (_automaticallyAppendNewlineForCustomFormatters) ? 5 : 4;
|
||||
struct iovec v[iovec_len];
|
||||
|
||||
if (colorProfile) {
|
||||
@@ -1262,7 +1263,7 @@ static DDTTYLogger *sharedInstance;
|
||||
v[iovec_len - 1].iov_len = 0;
|
||||
}
|
||||
|
||||
v[2].iov_base = (char *)msg;
|
||||
v[2].iov_base = msg;
|
||||
v[2].iov_len = msgLen;
|
||||
|
||||
if (iovec_len == 5) {
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, 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 <CocoaLumberjack/DDContextFilterLogFormatter+Deprecated.h>
|
||||
|
||||
@implementation DDContextAllowlistFilterLogFormatter (Deprecated)
|
||||
|
||||
- (void)addToWhitelist:(NSInteger)loggingContext {
|
||||
[self addToAllowlist:loggingContext];
|
||||
}
|
||||
|
||||
- (void)removeFromWhitelist:(NSInteger)loggingContext {
|
||||
[self removeFromAllowlist:loggingContext];
|
||||
}
|
||||
|
||||
- (NSArray *)whitelist {
|
||||
return [self allowlist];
|
||||
}
|
||||
|
||||
- (BOOL)isOnWhitelist:(NSInteger)loggingContext {
|
||||
return [self isOnAllowlist:loggingContext];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation DDContextDenylistFilterLogFormatter (Deprecated)
|
||||
|
||||
- (void)addToBlacklist:(NSInteger)loggingContext {
|
||||
[self addToDenylist:loggingContext];
|
||||
}
|
||||
|
||||
- (void)removeFromBlacklist:(NSInteger)loggingContext {
|
||||
[self removeFromDenylist:loggingContext];
|
||||
}
|
||||
|
||||
- (NSArray *)blacklist {
|
||||
return [self denylist];
|
||||
}
|
||||
|
||||
- (BOOL)isOnBlacklist:(NSInteger)loggingContext {
|
||||
return [self isOnDenylist:loggingContext];
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+15
-26
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -36,40 +36,38 @@
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@interface DDContextWhitelistFilterLogFormatter () {
|
||||
@interface DDContextAllowlistFilterLogFormatter () {
|
||||
DDLoggingContextSet *_contextSet;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation DDContextWhitelistFilterLogFormatter
|
||||
@implementation DDContextAllowlistFilterLogFormatter
|
||||
|
||||
- (instancetype)init {
|
||||
if ((self = [super init])) {
|
||||
_contextSet = [[DDLoggingContextSet alloc] init];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)addToWhitelist:(NSInteger)loggingContext {
|
||||
- (void)addToAllowlist:(NSInteger)loggingContext {
|
||||
[_contextSet addToSet:loggingContext];
|
||||
}
|
||||
|
||||
- (void)removeFromWhitelist:(NSInteger)loggingContext {
|
||||
- (void)removeFromAllowlist:(NSInteger)loggingContext {
|
||||
[_contextSet removeFromSet:loggingContext];
|
||||
}
|
||||
|
||||
- (NSArray *)whitelist {
|
||||
- (NSArray *)allowlist {
|
||||
return [_contextSet currentSet];
|
||||
}
|
||||
|
||||
- (BOOL)isOnWhitelist:(NSInteger)loggingContext {
|
||||
- (BOOL)isOnAllowlist:(NSInteger)loggingContext {
|
||||
return [_contextSet isInSet:loggingContext];
|
||||
}
|
||||
|
||||
- (NSString *)formatLogMessage:(DDLogMessage *)logMessage {
|
||||
if ([self isOnWhitelist:logMessage->_context]) {
|
||||
if ([self isOnAllowlist:logMessage->_context]) {
|
||||
return logMessage->_message;
|
||||
} else {
|
||||
return nil;
|
||||
@@ -78,45 +76,39 @@
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@interface DDContextBlacklistFilterLogFormatter () {
|
||||
@interface DDContextDenylistFilterLogFormatter () {
|
||||
DDLoggingContextSet *_contextSet;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation DDContextBlacklistFilterLogFormatter
|
||||
@implementation DDContextDenylistFilterLogFormatter
|
||||
|
||||
- (instancetype)init {
|
||||
if ((self = [super init])) {
|
||||
_contextSet = [[DDLoggingContextSet alloc] init];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)addToBlacklist:(NSInteger)loggingContext {
|
||||
- (void)addToDenylist:(NSInteger)loggingContext {
|
||||
[_contextSet addToSet:loggingContext];
|
||||
}
|
||||
|
||||
- (void)removeFromBlacklist:(NSInteger)loggingContext {
|
||||
- (void)removeFromDenylist:(NSInteger)loggingContext {
|
||||
[_contextSet removeFromSet:loggingContext];
|
||||
}
|
||||
|
||||
- (NSArray *)blacklist {
|
||||
- (NSArray *)denylist {
|
||||
return [_contextSet currentSet];
|
||||
}
|
||||
|
||||
- (BOOL)isOnBlacklist:(NSInteger)loggingContext {
|
||||
- (BOOL)isOnDenylist:(NSInteger)loggingContext {
|
||||
return [_contextSet isInSet:loggingContext];
|
||||
}
|
||||
|
||||
- (NSString *)formatLogMessage:(DDLogMessage *)logMessage {
|
||||
if ([self isOnBlacklist:logMessage->_context]) {
|
||||
if ([self isOnDenylist:logMessage->_context]) {
|
||||
return nil;
|
||||
} else {
|
||||
return logMessage->_message;
|
||||
@@ -129,15 +121,12 @@
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@interface DDLoggingContextSet () {
|
||||
pthread_mutex_t _mutex;
|
||||
NSMutableSet *_set;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation DDLoggingContextSet
|
||||
|
||||
- (instancetype)init {
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
Vendored
+2
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -90,6 +90,7 @@ FOUNDATION_EXPORT const unsigned char CocoaLumberjackVersionString[];
|
||||
|
||||
// Extensions
|
||||
#import <CocoaLumberjack/DDContextFilterLogFormatter.h>
|
||||
#import <CocoaLumberjack/DDContextFilterLogFormatter+Deprecated.h>
|
||||
#import <CocoaLumberjack/DDDispatchQueueLogFormatter.h>
|
||||
#import <CocoaLumberjack/DDMultiFormatter.h>
|
||||
#import <CocoaLumberjack/DDFileLogger+Buffering.h>
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
Vendored
+3
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -13,6 +13,8 @@
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
Carthage/Checkouts/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDASLLogCapture.h
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
Vendored
+6
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -23,3 +23,8 @@
|
||||
NSAssert(NO, @"%@", description); \
|
||||
}
|
||||
#define DDAssertCondition(condition) DDAssert(condition, @"Condition not satisfied: %s", #condition)
|
||||
|
||||
/**
|
||||
* Analog to `DDAssertionFailure` from DDAssert.swift for use in Objective C
|
||||
*/
|
||||
#define DDAssertionFailure(frmt, ...) DDAssert(NO, frmt, ##__VA_ARGS__)
|
||||
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, 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 <CocoaLumberjack/DDContextFilterLogFormatter.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This class provides a log formatter that filters log statements from a logging context not on the whitelist.
|
||||
* @deprecated Use DDContextAllowlistFilterLogFormatter instead.
|
||||
*
|
||||
* A log formatter can be added to any logger to format and/or filter its output.
|
||||
* You can learn more about log formatters here:
|
||||
* Documentation/CustomFormatters.md
|
||||
*
|
||||
* You can learn more about logging context's here:
|
||||
* Documentation/CustomContext.md
|
||||
*
|
||||
* But here's a quick overview / refresher:
|
||||
*
|
||||
* Every log statement has a logging context.
|
||||
* These come from the underlying logging macros defined in DDLog.h.
|
||||
* The default logging context is zero.
|
||||
* You can define multiple logging context's for use in your application.
|
||||
* For example, logically separate parts of your app each have a different logging context.
|
||||
* Also 3rd party frameworks that make use of Lumberjack generally use their own dedicated logging context.
|
||||
**/
|
||||
__attribute__((deprecated("Use DDContextAllowlistFilterLogFormatter instead")))
|
||||
typedef DDContextAllowlistFilterLogFormatter DDContextWhitelistFilterLogFormatter;
|
||||
|
||||
@interface DDContextAllowlistFilterLogFormatter (Deprecated)
|
||||
|
||||
/**
|
||||
* Add a context to the whitelist
|
||||
* @deprecated Use -addToAllowlist: instead.
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)addToWhitelist:(NSInteger)loggingContext __attribute__((deprecated("Use -addToAllowlist: instead")));
|
||||
|
||||
/**
|
||||
* Remove context from whitelist
|
||||
* @deprecated Use -removeFromAllowlist: instead.
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)removeFromWhitelist:(NSInteger)loggingContext __attribute__((deprecated("Use -removeFromAllowlist: instead")));
|
||||
|
||||
/**
|
||||
* Return the whitelist
|
||||
* @deprecated Use allowlist instead.
|
||||
*/
|
||||
@property (nonatomic, readonly, copy) NSArray<NSNumber *> *whitelist __attribute__((deprecated("Use allowlist instead")));
|
||||
|
||||
/**
|
||||
* Check if a context is on the whitelist
|
||||
* @deprecated Use -isOnAllowlist: instead.
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (BOOL)isOnWhitelist:(NSInteger)loggingContext __attribute__((deprecated("Use -isOnAllowlist: instead")));
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
* This class provides a log formatter that filters log statements from a logging context on the blacklist.
|
||||
* @deprecated Use DDContextDenylistFilterLogFormatter instead.
|
||||
**/
|
||||
__attribute__((deprecated("Use DDContextDenylistFilterLogFormatter instead")))
|
||||
typedef DDContextDenylistFilterLogFormatter DDContextBlacklistFilterLogFormatter;
|
||||
|
||||
@interface DDContextDenylistFilterLogFormatter (Deprecated)
|
||||
|
||||
/**
|
||||
* Add a context to the blacklist
|
||||
* @deprecated Use -addToDenylist: instead.
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)addToBlacklist:(NSInteger)loggingContext __attribute__((deprecated("Use -addToDenylist: instead")));
|
||||
|
||||
/**
|
||||
* Remove context from blacklist
|
||||
* @deprecated Use -removeFromDenylist: instead.
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)removeFromBlacklist:(NSInteger)loggingContext __attribute__((deprecated("Use -removeFromDenylist: instead")));
|
||||
|
||||
/**
|
||||
* Return the blacklist
|
||||
* @deprecated Use denylist instead.
|
||||
*/
|
||||
@property (readonly, copy) NSArray<NSNumber *> *blacklist __attribute__((deprecated("Use denylist instead")));
|
||||
|
||||
/**
|
||||
* Check if a context is on the blacklist
|
||||
* @deprecated Use -isOnDenylist: instead.
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (BOOL)isOnBlacklist:(NSInteger)loggingContext __attribute__((deprecated("Use -isOnDenylist: instead")));
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+21
-25
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -25,7 +25,7 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This class provides a log formatter that filters log statements from a logging context not on the whitelist.
|
||||
* This class provides a log formatter that filters log statements from a logging context not on the allowlist.
|
||||
*
|
||||
* A log formatter can be added to any logger to format and/or filter its output.
|
||||
* You can learn more about log formatters here:
|
||||
@@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* For example, logically separate parts of your app each have a different logging context.
|
||||
* Also 3rd party frameworks that make use of Lumberjack generally use their own dedicated logging context.
|
||||
**/
|
||||
@interface DDContextWhitelistFilterLogFormatter : NSObject <DDLogFormatter>
|
||||
@interface DDContextAllowlistFilterLogFormatter : NSObject <DDLogFormatter>
|
||||
|
||||
/**
|
||||
* Designated default initializer
|
||||
@@ -51,70 +51,66 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Add a context to the whitelist
|
||||
* Add a context to the allowlist
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)addToWhitelist:(NSInteger)loggingContext;
|
||||
- (void)addToAllowlist:(NSInteger)loggingContext;
|
||||
|
||||
/**
|
||||
* Remove context from whitelist
|
||||
* Remove context from allowlist
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)removeFromWhitelist:(NSInteger)loggingContext;
|
||||
- (void)removeFromAllowlist:(NSInteger)loggingContext;
|
||||
|
||||
/**
|
||||
* Return the whitelist
|
||||
* Return the allowlist
|
||||
*/
|
||||
@property (nonatomic, readonly, copy) NSArray<NSNumber *> *whitelist;
|
||||
@property (nonatomic, readonly, copy) NSArray<NSNumber *> *allowlist;
|
||||
|
||||
/**
|
||||
* Check if a context is on the whitelist
|
||||
* Check if a context is on the allowlist
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (BOOL)isOnWhitelist:(NSInteger)loggingContext;
|
||||
- (BOOL)isOnAllowlist:(NSInteger)loggingContext;
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* This class provides a log formatter that filters log statements from a logging context on the blacklist.
|
||||
* This class provides a log formatter that filters log statements from a logging context on the denylist.
|
||||
**/
|
||||
@interface DDContextBlacklistFilterLogFormatter : NSObject <DDLogFormatter>
|
||||
@interface DDContextDenylistFilterLogFormatter : NSObject <DDLogFormatter>
|
||||
|
||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Add a context to the blacklist
|
||||
* Add a context to the denylist
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)addToBlacklist:(NSInteger)loggingContext;
|
||||
- (void)addToDenylist:(NSInteger)loggingContext;
|
||||
|
||||
/**
|
||||
* Remove context from blacklist
|
||||
* Remove context from denylist
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)removeFromBlacklist:(NSInteger)loggingContext;
|
||||
- (void)removeFromDenylist:(NSInteger)loggingContext;
|
||||
|
||||
/**
|
||||
* Return the blacklist
|
||||
* Return the denylist
|
||||
*/
|
||||
@property (readonly, copy) NSArray<NSNumber *> *blacklist;
|
||||
|
||||
@property (readonly, copy) NSArray<NSNumber *> *denylist;
|
||||
|
||||
/**
|
||||
* Check if a context is on the blacklist
|
||||
* Check if a context is on the denylist
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (BOOL)isOnBlacklist:(NSInteger)loggingContext;
|
||||
- (BOOL)isOnDenylist:(NSInteger)loggingContext;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+14
-4
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -25,6 +25,10 @@
|
||||
#import <CocoaLumberjack/DDLegacyMacros.h>
|
||||
#endif
|
||||
|
||||
#ifndef DD_LEGACY_MESSAGE_TAG
|
||||
#define DD_LEGACY_MESSAGE_TAG 1
|
||||
#endif
|
||||
|
||||
// Names of loggers.
|
||||
#import <CocoaLumberjack/DDLoggerNames.h>
|
||||
|
||||
@@ -621,7 +625,7 @@ FOUNDATION_EXTERN NSString * __nullable DDExtractFileNameWithoutExtension(const
|
||||
* For example, a database logger may only save occasionally as the disk IO is slow.
|
||||
* In such loggers, this method should be implemented to flush any pending IO.
|
||||
*
|
||||
* This allows invocations of DDLog's flushLog method to be propogated to loggers that need it.
|
||||
* This allows invocations of DDLog's flushLog method to be propagated to loggers that need it.
|
||||
*
|
||||
* Note that DDLog's flushLog method is invoked automatically when the application quits,
|
||||
* and it may be also invoked manually by the developer prior to application crashes, or other such reasons.
|
||||
@@ -778,7 +782,10 @@ typedef NS_OPTIONS(NSInteger, DDLogMessageOptions){
|
||||
NSString *_fileName;
|
||||
NSString *_function;
|
||||
NSUInteger _line;
|
||||
id _tag;
|
||||
#if DD_LEGACY_MESSAGE_TAG
|
||||
id _tag __attribute__((deprecated("Use _representedObject instead", "_representedObject")));;
|
||||
#endif
|
||||
id _representedObject;
|
||||
DDLogMessageOptions _options;
|
||||
NSDate * _timestamp;
|
||||
NSString *_threadID;
|
||||
@@ -845,7 +852,10 @@ typedef NS_OPTIONS(NSInteger, DDLogMessageOptions){
|
||||
@property (readonly, nonatomic) NSString *fileName;
|
||||
@property (readonly, nonatomic, nullable) NSString * function;
|
||||
@property (readonly, nonatomic) NSUInteger line;
|
||||
@property (readonly, nonatomic, nullable) id tag;
|
||||
#if DD_LEGACY_MESSAGE_TAG
|
||||
@property (readonly, nonatomic, nullable) id tag __attribute__((deprecated("Use representedObject instead", "representedObject")));
|
||||
#endif
|
||||
@property (readonly, nonatomic, nullable) id representedObject;
|
||||
@property (readonly, nonatomic) DDLogMessageOptions options;
|
||||
@property (readonly, nonatomic) NSDate *timestamp;
|
||||
@property (readonly, nonatomic) NSString *threadID; // ID as it appears in NSLog calculated from the machThreadID
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
Vendored
+56
-11
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -114,10 +114,17 @@ final class SwiftLogMessage: DDLogMessage {
|
||||
public struct DDLogHandler: LogHandler {
|
||||
@usableFromInline
|
||||
struct Configuration {
|
||||
@usableFromInline
|
||||
struct SyncLogging {
|
||||
@usableFromInline
|
||||
let tresholdLevel: Logger.Level
|
||||
@usableFromInline
|
||||
let metadataKey: Logger.Metadata.Key
|
||||
}
|
||||
@usableFromInline
|
||||
let log: DDLog
|
||||
@usableFromInline
|
||||
let syncLoggingTresholdLevel: Logger.Level
|
||||
let syncLogging: SyncLogging
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
@@ -135,12 +142,14 @@ public struct DDLogHandler: LogHandler {
|
||||
@usableFromInline
|
||||
var loggerInfo: LoggerInfo
|
||||
|
||||
@inlinable
|
||||
public var logLevel: Logger.Level {
|
||||
get { loggerInfo.logLevel }
|
||||
get { return loggerInfo.logLevel }
|
||||
set { loggerInfo.logLevel = newValue }
|
||||
}
|
||||
@inlinable
|
||||
public var metadata: Logger.Metadata {
|
||||
get { loggerInfo.metadata }
|
||||
get { return loggerInfo.metadata }
|
||||
set { loggerInfo.metadata = newValue }
|
||||
}
|
||||
|
||||
@@ -155,6 +164,25 @@ public struct DDLogHandler: LogHandler {
|
||||
self.loggerInfo = loggerInfo
|
||||
}
|
||||
|
||||
/// Returns whether a message with the given level and the given metadata should be logged asynchronous.
|
||||
/// - Parameters:
|
||||
/// - level: The level at which the message was logged.
|
||||
/// - metadata: The metadata associated with the message.
|
||||
/// - Returns: Whether to log the message asynchronous.
|
||||
@usableFromInline
|
||||
func _logAsync(level: Logger.Level, metadata: Logger.Metadata?) -> Bool { // swiftlint:disable:this identifier_name
|
||||
if level >= config.syncLogging.tresholdLevel {
|
||||
// Easiest check -> level is above treshold. Not async.
|
||||
return false
|
||||
} else if case .stringConvertible(let logSynchronous as Bool) = metadata?[config.syncLogging.metadataKey] {
|
||||
// There's a metadata value, return it's value. We need to invert it since it defines whether to log _synchronous_.
|
||||
return !logSynchronous
|
||||
} else {
|
||||
// If we're below the treshold and no metadata value is set -> we're logging async.
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func log(level: Logger.Level,
|
||||
message: Logger.Message,
|
||||
@@ -172,24 +200,36 @@ public struct DDLogHandler: LogHandler {
|
||||
file: file,
|
||||
function: function,
|
||||
line: line)
|
||||
config.log.log(asynchronous: level < config.syncLoggingTresholdLevel,
|
||||
message: slMessage)
|
||||
config.log.log(asynchronous: _logAsync(level: level, metadata: metadata), message: slMessage)
|
||||
}
|
||||
}
|
||||
|
||||
extension DDLogHandler {
|
||||
/// The default key to control per message whether to log it synchronous or asynchronous.
|
||||
public static var defaultSynchronousLoggingMetadataKey: Logger.Metadata.Key {
|
||||
return "log-synchronous"
|
||||
}
|
||||
|
||||
/// Creates a new `LogHandler` factory using `DDLogHandler` with the given parameters.
|
||||
/// - Parameters:
|
||||
/// - log: The `DDLog` instance to use for logging. Defaults to `DDLog.sharedInstance`.
|
||||
/// - defaultLogLevel: The default log level for new loggers. Defaults to `.info`.
|
||||
/// - syncLoggingTreshold: The level as of which log messages should be logged synchronously instead of asynchronously. Defaults to `.error`.
|
||||
/// - synchronousLoggingMetadataKey: The metadata key to check on messages to decide whether to log synchronous or asynchronous. Defaults to `DDLogHandler.defaultSynchronousLoggingMetadataKey`.
|
||||
/// - Returns: A new `LogHandler` factory using `DDLogHandler` that can be passed to `LoggingSystem.bootstrap`.
|
||||
/// - SeeAlso: `DDLog`, `LoggingSystem.boostrap`
|
||||
public static func handlerFactory(for log: DDLog = .sharedInstance,
|
||||
defaultLogLevel: Logger.Level = .info,
|
||||
loggingSynchronousAsOf syncLoggingTreshold: Logger.Level = .error) -> (String) -> LogHandler {
|
||||
let config = DDLogHandler.Configuration(log: log, syncLoggingTresholdLevel: syncLoggingTreshold)
|
||||
return { DDLogHandler(config: config, loggerInfo: .init(label: $0, logLevel: defaultLogLevel)) }
|
||||
loggingSynchronousAsOf syncLoggingTreshold: Logger.Level = .error,
|
||||
synchronousLoggingMetadataKey: Logger.Metadata.Key = DDLogHandler.defaultSynchronousLoggingMetadataKey) -> (String) -> LogHandler {
|
||||
let config = DDLogHandler.Configuration(
|
||||
log: log,
|
||||
syncLogging: .init(tresholdLevel: syncLoggingTreshold,
|
||||
metadataKey: synchronousLoggingMetadataKey)
|
||||
)
|
||||
return {
|
||||
DDLogHandler(config: config, loggerInfo: .init(label: $0, logLevel: defaultLogLevel))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,11 +239,16 @@ extension LoggingSystem {
|
||||
/// - log: The `DDLog` instance to use for logging. Defaults to `DDLog.sharedInstance`.
|
||||
/// - defaultLogLevel: The default log level for new loggers. Defaults to `.info`.
|
||||
/// - syncLoggingTreshold: The level as of which log messages should be logged synchronously instead of asynchronously. Defaults to `.error`.
|
||||
/// - synchronousLoggingMetadataKey: The metadata key to check on messages to decide whether to log synchronous or asynchronous. Defaults to `DDLogHandler.defaultSynchronousLoggingMetadataKey`.
|
||||
/// - SeeAlso: `DDLogHandler.handlerFactory`, `LoggingSystem.bootstrap`
|
||||
@inlinable
|
||||
public static func bootstrapWithCocoaLumberjack(for log: DDLog = .sharedInstance,
|
||||
defaultLogLevel: Logger.Level = .info,
|
||||
loggingSynchronousAsOf syncLoggingTreshold: Logger.Level = .error) {
|
||||
bootstrap(DDLogHandler.handlerFactory(for: log, defaultLogLevel: defaultLogLevel, loggingSynchronousAsOf: syncLoggingTreshold))
|
||||
loggingSynchronousAsOf syncLoggingTreshold: Logger.Level = .error,
|
||||
synchronousLoggingMetadataKey: Logger.Metadata.Key = DDLogHandler.defaultSynchronousLoggingMetadataKey) {
|
||||
bootstrap(DDLogHandler.handlerFactory(for: log,
|
||||
defaultLogLevel: defaultLogLevel,
|
||||
loggingSynchronousAsOf: syncLoggingTreshold,
|
||||
synchronousLoggingMetadataKey: synchronousLoggingMetadataKey))
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
Carthage/Checkouts/CocoaLumberjack/Tests/CocoaLumberjackSwiftLogBackendTests/DDLogHandlerTests.swift
Vendored
+52
-25
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -107,40 +107,67 @@ final class DDLogHandlerTests: XCTestCase {
|
||||
XCTAssertEqual(ddLogHandler.loggerInfo.label, logger.label)
|
||||
XCTAssertTrue(ddLogHandler.loggerInfo.metadata.isEmpty)
|
||||
XCTAssertTrue(ddLogHandler.config.log === DDLog.sharedInstance)
|
||||
XCTAssertEqual(ddLogHandler.config.syncLoggingTresholdLevel, .error)
|
||||
XCTAssertEqual(ddLogHandler.config.syncLogging.tresholdLevel, .error)
|
||||
XCTAssertEqual(ddLogHandler.config.syncLogging.metadataKey, DDLogHandler.defaultSynchronousLoggingMetadataKey)
|
||||
}
|
||||
|
||||
func testLoggingAllLevels() throws {
|
||||
let syncTresholdLevel = Logger.Level.warning
|
||||
LoggingSystem.bootstrapInternal(DDLogHandler.handlerFactory(for: mockDDLog, loggingSynchronousAsOf: syncTresholdLevel))
|
||||
let syncLoggingMetadataKey: Logger.Metadata.Key = "test-log-sync"
|
||||
LoggingSystem.bootstrapInternal(DDLogHandler.handlerFactory(for: mockDDLog,
|
||||
loggingSynchronousAsOf: syncTresholdLevel,
|
||||
synchronousLoggingMetadataKey: syncLoggingMetadataKey))
|
||||
var logger = Logger(label: "TestLogger")
|
||||
logger.logLevel = .trace // enable all logs
|
||||
logger[metadataKey: "test-data"] = "test-value"
|
||||
XCTAssertEqual(logger.logLevel, .trace)
|
||||
XCTAssertEqual(logger[metadataKey: "test-data"], "test-value")
|
||||
let messageMeta: Logger.Metadata = ["msg-data": "msg-value"]
|
||||
let logLine: UInt = #line + 2
|
||||
for level in Logger.Level.allCases {
|
||||
logger.log(level: level, "\(level)-msg", metadata: messageMeta)
|
||||
let allLevels = Logger.Level.allCases
|
||||
let message1Meta: Logger.Metadata = ["msg-data": "msg-value"]
|
||||
let message2Meta = message1Meta.merging([syncLoggingMetadataKey: .stringConvertible(true)], uniquingKeysWith: { $1 })
|
||||
let logLine1: UInt = #line + 3
|
||||
let logLine2 = logLine1 + 1
|
||||
for level in allLevels {
|
||||
logger.log(level: level, "\(level)-msg", metadata: message1Meta)
|
||||
logger.log(level: level, "\(level)-msg-with-sync", metadata: message2Meta)
|
||||
}
|
||||
XCTAssertEqual(mockDDLog.loggedMessages.count, Logger.Level.allCases.count)
|
||||
guard mockDDLog.loggedMessages.count >= Logger.Level.allCases.count else { return } // prevent test crashes
|
||||
for (idx, level) in Logger.Level.allCases.enumerated() {
|
||||
let loggedMsg = mockDDLog.loggedMessages[idx]
|
||||
XCTAssertEqual(loggedMsg.async, level < syncTresholdLevel)
|
||||
XCTAssertEqual(loggedMsg.message.message, "\(level)-msg")
|
||||
XCTAssertEqual(loggedMsg.message.level, level.ddLogLevelAndFlag.0)
|
||||
XCTAssertEqual(loggedMsg.message.flag, level.ddLogLevelAndFlag.1)
|
||||
XCTAssertEqual(loggedMsg.message.file, #file)
|
||||
XCTAssertEqual(loggedMsg.message.function, #function)
|
||||
XCTAssertEqual(loggedMsg.message.line, logLine)
|
||||
XCTAssertNotNil(loggedMsg.message.swiftLogInfo)
|
||||
XCTAssertEqual(loggedMsg.message.swiftLogInfo, .init(logger: .init(label: logger.label,
|
||||
metadata: logger.handler.metadata),
|
||||
message: .init(message: "\(level)-msg",
|
||||
level: level,
|
||||
metadata: messageMeta,
|
||||
source: logSource)))
|
||||
XCTAssertEqual(mockDDLog.loggedMessages.count, Logger.Level.allCases.count * 2)
|
||||
guard mockDDLog.loggedMessages.count >= Logger.Level.allCases.count * 2 else { return } // prevent test crashes
|
||||
|
||||
zip(allLevels, stride(from: mockDDLog.loggedMessages.startIndex, to: mockDDLog.loggedMessages.endIndex, by: 2)).forEach {
|
||||
let level = $0.0
|
||||
|
||||
let loggedMsg1 = mockDDLog.loggedMessages[$0.1]
|
||||
XCTAssertEqual(loggedMsg1.async, level < syncTresholdLevel)
|
||||
XCTAssertEqual(loggedMsg1.message.message, "\(level)-msg")
|
||||
XCTAssertEqual(loggedMsg1.message.level, level.ddLogLevelAndFlag.0)
|
||||
XCTAssertEqual(loggedMsg1.message.flag, level.ddLogLevelAndFlag.1)
|
||||
XCTAssertEqual(loggedMsg1.message.file, #file)
|
||||
XCTAssertEqual(loggedMsg1.message.function, #function)
|
||||
XCTAssertEqual(loggedMsg1.message.line, logLine1)
|
||||
XCTAssertNotNil(loggedMsg1.message.swiftLogInfo)
|
||||
XCTAssertEqual(loggedMsg1.message.swiftLogInfo, .init(logger: .init(label: logger.label,
|
||||
metadata: logger.handler.metadata),
|
||||
message: .init(message: "\(level)-msg",
|
||||
level: level,
|
||||
metadata: message1Meta,
|
||||
source: logSource)))
|
||||
|
||||
let loggedMsg2 = mockDDLog.loggedMessages[$0.1 + 1]
|
||||
XCTAssertFalse(loggedMsg2.async)
|
||||
XCTAssertEqual(loggedMsg2.message.message, "\(level)-msg-with-sync")
|
||||
XCTAssertEqual(loggedMsg2.message.level, level.ddLogLevelAndFlag.0)
|
||||
XCTAssertEqual(loggedMsg2.message.flag, level.ddLogLevelAndFlag.1)
|
||||
XCTAssertEqual(loggedMsg2.message.file, #file)
|
||||
XCTAssertEqual(loggedMsg2.message.function, #function)
|
||||
XCTAssertEqual(loggedMsg2.message.line, logLine2)
|
||||
XCTAssertNotNil(loggedMsg2.message.swiftLogInfo)
|
||||
XCTAssertEqual(loggedMsg2.message.swiftLogInfo, .init(logger: .init(label: logger.label,
|
||||
metadata: logger.handler.metadata),
|
||||
message: .init(message: "\(level)-msg-with-sync",
|
||||
level: level,
|
||||
metadata: message2Meta,
|
||||
source: logSource)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, 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 <XCTest/XCTest.h>
|
||||
#import <CocoaLumberjack/DDContextFilterLogFormatter+Deprecated.h>
|
||||
|
||||
static DDLogMessage *testLogMessage() {
|
||||
return [[DDLogMessage alloc] initWithMessage:@"test log message"
|
||||
level:DDLogLevelDebug
|
||||
flag:DDLogFlagError
|
||||
context:1
|
||||
file:@(__FILE__)
|
||||
function:@(__func__)
|
||||
line:__LINE__
|
||||
tag:NULL
|
||||
options:(DDLogMessageOptions)0
|
||||
timestamp:nil];
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
@interface DDContextWhitelistFilterLogFormatterTests : XCTestCase
|
||||
@property (nonatomic, strong, readwrite) DDContextWhitelistFilterLogFormatter *filterLogFormatter;
|
||||
@end
|
||||
|
||||
@implementation DDContextWhitelistFilterLogFormatterTests
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
self.filterLogFormatter = [[DDContextWhitelistFilterLogFormatter alloc] init];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
self.filterLogFormatter = nil;
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void)testWhitelistFilterLogFormatter {
|
||||
XCTAssertEqualObjects([self.filterLogFormatter whitelist], @[]);
|
||||
XCTAssertFalse([self.filterLogFormatter isOnWhitelist:1]);
|
||||
XCTAssertNil([self.filterLogFormatter formatLogMessage:testLogMessage()]);
|
||||
|
||||
[self.filterLogFormatter addToWhitelist:1];
|
||||
XCTAssertEqualObjects([self.filterLogFormatter whitelist], @[@1]);
|
||||
XCTAssertTrue([self.filterLogFormatter isOnWhitelist:1]);
|
||||
XCTAssertEqualObjects([self.filterLogFormatter formatLogMessage:testLogMessage()], @"test log message");
|
||||
|
||||
[self.filterLogFormatter removeFromWhitelist:1];
|
||||
XCTAssertEqualObjects([self.filterLogFormatter whitelist], @[]);
|
||||
XCTAssertFalse([self.filterLogFormatter isOnWhitelist:1]);
|
||||
XCTAssertNil([self.filterLogFormatter formatLogMessage:testLogMessage()]);
|
||||
}
|
||||
|
||||
@end
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
@interface DDContextBlacklistFilterLogFormatterTests : XCTestCase
|
||||
@property (nonatomic, strong, readwrite) DDContextBlacklistFilterLogFormatter *filterLogFormatter;
|
||||
@end
|
||||
|
||||
@implementation DDContextBlacklistFilterLogFormatterTests
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
self.filterLogFormatter = [[DDContextBlacklistFilterLogFormatter alloc] init];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
self.filterLogFormatter = nil;
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void)testDDContextBlacklistFilterLogFormatterTests {
|
||||
XCTAssertEqualObjects([self.filterLogFormatter blacklist], @[]);
|
||||
XCTAssertFalse([self.filterLogFormatter isOnBlacklist:1]);
|
||||
XCTAssertEqualObjects([self.filterLogFormatter formatLogMessage:testLogMessage()], @"test log message");
|
||||
|
||||
[self.filterLogFormatter addToBlacklist:1];
|
||||
XCTAssertEqualObjects([self.filterLogFormatter blacklist], @[@1]);
|
||||
XCTAssertTrue([self.filterLogFormatter isOnBlacklist:1]);
|
||||
XCTAssertNil([self.filterLogFormatter formatLogMessage:testLogMessage()]);
|
||||
|
||||
[self.filterLogFormatter removeFromBlacklist:1];
|
||||
XCTAssertEqualObjects([self.filterLogFormatter blacklist], @[]);
|
||||
XCTAssertFalse([self.filterLogFormatter isOnBlacklist:1]);
|
||||
XCTAssertEqualObjects([self.filterLogFormatter formatLogMessage:testLogMessage()], @"test log message");
|
||||
}
|
||||
|
||||
@end
|
||||
#pragma clang diagnostic pop
|
||||
Vendored
+99
@@ -0,0 +1,99 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, 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 <XCTest/XCTest.h>
|
||||
#import <CocoaLumberjack/DDContextFilterLogFormatter.h>
|
||||
|
||||
static DDLogMessage *testLogMessage() {
|
||||
return [[DDLogMessage alloc] initWithMessage:@"test log message"
|
||||
level:DDLogLevelDebug
|
||||
flag:DDLogFlagError
|
||||
context:1
|
||||
file:@(__FILE__)
|
||||
function:@(__func__)
|
||||
line:__LINE__
|
||||
tag:NULL
|
||||
options:(DDLogMessageOptions)0
|
||||
timestamp:nil];
|
||||
}
|
||||
|
||||
@interface DDContextAllowlistFilterLogFormatterTests : XCTestCase
|
||||
@property (nonatomic, strong, readwrite) DDContextAllowlistFilterLogFormatter *filterLogFormatter;
|
||||
@end
|
||||
|
||||
@implementation DDContextAllowlistFilterLogFormatterTests
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
self.filterLogFormatter = [[DDContextAllowlistFilterLogFormatter alloc] init];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
self.filterLogFormatter = nil;
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void)testAllowlistFilterLogFormatter {
|
||||
XCTAssertEqualObjects([self.filterLogFormatter allowlist], @[]);
|
||||
XCTAssertFalse([self.filterLogFormatter isOnAllowlist:1]);
|
||||
XCTAssertNil([self.filterLogFormatter formatLogMessage:testLogMessage()]);
|
||||
|
||||
[self.filterLogFormatter addToAllowlist:1];
|
||||
XCTAssertEqualObjects([self.filterLogFormatter allowlist], @[@1]);
|
||||
XCTAssertTrue([self.filterLogFormatter isOnAllowlist:1]);
|
||||
XCTAssertEqualObjects([self.filterLogFormatter formatLogMessage:testLogMessage()], @"test log message");
|
||||
|
||||
[self.filterLogFormatter removeFromAllowlist:1];
|
||||
XCTAssertEqualObjects([self.filterLogFormatter allowlist], @[]);
|
||||
XCTAssertFalse([self.filterLogFormatter isOnAllowlist:1]);
|
||||
XCTAssertNil([self.filterLogFormatter formatLogMessage:testLogMessage()]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface DDContextDenylistFilterLogFormatterTests : XCTestCase
|
||||
@property (nonatomic, strong, readwrite) DDContextDenylistFilterLogFormatter *filterLogFormatter;
|
||||
@end
|
||||
|
||||
@implementation DDContextDenylistFilterLogFormatterTests
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
self.filterLogFormatter = [[DDContextDenylistFilterLogFormatter alloc] init];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
self.filterLogFormatter = nil;
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void)testDDContextDenylistFilterLogFormatterTests {
|
||||
XCTAssertEqualObjects([self.filterLogFormatter denylist], @[]);
|
||||
XCTAssertFalse([self.filterLogFormatter isOnDenylist:1]);
|
||||
XCTAssertEqualObjects([self.filterLogFormatter formatLogMessage:testLogMessage()], @"test log message");
|
||||
|
||||
[self.filterLogFormatter addToDenylist:1];
|
||||
XCTAssertEqualObjects([self.filterLogFormatter denylist], @[@1]);
|
||||
XCTAssertTrue([self.filterLogFormatter isOnDenylist:1]);
|
||||
XCTAssertNil([self.filterLogFormatter formatLogMessage:testLogMessage()]);
|
||||
|
||||
[self.filterLogFormatter removeFromDenylist:1];
|
||||
XCTAssertEqualObjects([self.filterLogFormatter denylist], @[]);
|
||||
XCTAssertFalse([self.filterLogFormatter isOnDenylist:1]);
|
||||
XCTAssertEqualObjects([self.filterLogFormatter formatLogMessage:testLogMessage()], @"test log message");
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+26
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -208,6 +208,31 @@ static const DDLogLevel ddLogLevel = DDLogLevelAll;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)testMaximumNumberOfLogFiles {
|
||||
logger.doNotReuseLogFiles = YES;
|
||||
logger.logFileManager.maximumNumberOfLogFiles = 4;
|
||||
logger.maximumFileSize = 10;
|
||||
[DDLog addLogger:logger];
|
||||
DDLogError(@"Log 1 in the file");
|
||||
DDLogError(@"Log 2 in the file");
|
||||
DDLogError(@"Log 3 in the file");
|
||||
DDLogError(@"Log 4 in the file");
|
||||
|
||||
/// wait log queue finish.
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NSArray *oldFileNames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:self->logger.logFileManager.logsDirectory error:nil];
|
||||
XCTAssertEqual(oldFileNames.count, 4);
|
||||
|
||||
self->logger.logFileManager.maximumNumberOfLogFiles = 2;
|
||||
|
||||
/// wait delete old files finish.
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NSArray *newFileNames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:self->logger.logFileManager.logsDirectory error:nil];
|
||||
XCTAssertEqual(newFileNames.count, 2);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
- (void)testWrapping {
|
||||
__auto_type wrapped = [logger wrapWithBuffer];
|
||||
XCTAssert([wrapped.class isSubclassOfClass:NSProxy.class]);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+9
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -136,7 +136,11 @@ static NSString * const kDefaultMessage = @"Log message";
|
||||
XCTAssertEqualObjects(self.message.file, @"DDLogMessageTests.m");
|
||||
XCTAssertEqualObjects(self.message.function, @"testInitSetsAllPassedParameters");
|
||||
XCTAssertEqual(self.message.line, 50);
|
||||
XCTAssertEqualObjects(self.message.representedObject, NULL);
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
XCTAssertEqualObjects(self.message.tag, NULL);
|
||||
#pragma clang diagnostic pop
|
||||
XCTAssertEqual(self.message.options, DDLogMessageCopyFile);
|
||||
XCTAssertEqualObjects(self.message.timestamp, referenceDate);
|
||||
}
|
||||
@@ -221,7 +225,11 @@ static NSString * const kDefaultMessage = @"Log message";
|
||||
XCTAssertEqualObjects(self.message.fileName, copy.fileName);
|
||||
XCTAssertEqualObjects(self.message.function, copy.function);
|
||||
XCTAssertEqual(self.message.line, copy.line);
|
||||
XCTAssertEqualObjects(self.message.representedObject, copy.representedObject);
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
XCTAssertEqualObjects(self.message.tag, copy.tag);
|
||||
#pragma clang diagnostic pop
|
||||
XCTAssertEqual(self.message.options, copy.options);
|
||||
XCTAssertEqualObjects(self.message.timestamp, copy.timestamp);
|
||||
XCTAssertEqualObjects(self.message.threadID, copy.threadID);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
80AC19B22170AC58007800DC /* DDAtomicCounterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 80AC19B02170AC54007800DC /* DDAtomicCounterTests.m */; };
|
||||
B2C90DDF21B9796400A72FD2 /* DDLogFileManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C90DDE21B9796400A72FD2 /* DDLogFileManagerTests.m */; };
|
||||
B2C90DE321B9797800A72FD2 /* DDLogFileManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C90DDE21B9796400A72FD2 /* DDLogFileManagerTests.m */; };
|
||||
C70461FA260A210B0040853F /* DDContextFilterLogFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C70461F9260A210B0040853F /* DDContextFilterLogFormatterTests.m */; };
|
||||
C70461FB260A210B0040853F /* DDContextFilterLogFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C70461F9260A210B0040853F /* DDContextFilterLogFormatterTests.m */; };
|
||||
C76CFC962619EFB900949045 /* DDContextFilterLogFormatter+DeprecatedTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C76CFC952619EFB900949045 /* DDContextFilterLogFormatter+DeprecatedTests.m */; };
|
||||
C76CFC972619EFB900949045 /* DDContextFilterLogFormatter+DeprecatedTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C76CFC952619EFB900949045 /* DDContextFilterLogFormatter+DeprecatedTests.m */; };
|
||||
C7A5AB022191DA4D0074B29F /* DDBasicLoggingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C7A5AB012191DA4D0074B29F /* DDBasicLoggingTests.m */; };
|
||||
C7A5AB032191DA4D0074B29F /* DDBasicLoggingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C7A5AB012191DA4D0074B29F /* DDBasicLoggingTests.m */; };
|
||||
C7A5AB052191DB530074B29F /* DDOSLoggingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C7A5AB042191DB530074B29F /* DDOSLoggingTests.m */; };
|
||||
@@ -55,6 +59,13 @@
|
||||
remoteGlobalIDString = 19FF460F1B8B4D1400B43179;
|
||||
remoteInfo = CocoaLumberjackSwift;
|
||||
};
|
||||
D1CBDE5C2549A686001F63F7 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0A7D8FC7217A1E9000B496D7 /* Lumberjack.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 19FF46011B8B4CF400B43179;
|
||||
remoteInfo = CocoaLumberjack;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@@ -74,6 +85,8 @@
|
||||
6ECBFDB321E9A31500CBB679 /* DDFileLoggerPerformanceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDFileLoggerPerformanceTests.m; sourceTree = "<group>"; };
|
||||
80AC19B02170AC54007800DC /* DDAtomicCounterTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDAtomicCounterTests.m; sourceTree = "<group>"; };
|
||||
B2C90DDE21B9796400A72FD2 /* DDLogFileManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDLogFileManagerTests.m; sourceTree = "<group>"; };
|
||||
C70461F9260A210B0040853F /* DDContextFilterLogFormatterTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDContextFilterLogFormatterTests.m; sourceTree = "<group>"; };
|
||||
C76CFC952619EFB900949045 /* DDContextFilterLogFormatter+DeprecatedTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDContextFilterLogFormatter+DeprecatedTests.m"; sourceTree = "<group>"; };
|
||||
C7A5AB012191DA4D0074B29F /* DDBasicLoggingTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDBasicLoggingTests.m; sourceTree = "<group>"; };
|
||||
C7A5AB042191DB530074B29F /* DDOSLoggingTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDOSLoggingTests.m; sourceTree = "<group>"; };
|
||||
DA1B17371AB067EF004705E8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
@@ -152,18 +165,20 @@
|
||||
432B534B1AAE437D00843E69 /* CocoaLumberjackTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0A55DA2F22CE962F00686977 /* DDSampleFileManager.h */,
|
||||
0A55DA2D22CE962B00686977 /* DDSampleFileManager.m */,
|
||||
80AC19B02170AC54007800DC /* DDAtomicCounterTests.m */,
|
||||
C7A5AB012191DA4D0074B29F /* DDBasicLoggingTests.m */,
|
||||
C76CFC952619EFB900949045 /* DDContextFilterLogFormatter+DeprecatedTests.m */,
|
||||
C70461F9260A210B0040853F /* DDContextFilterLogFormatterTests.m */,
|
||||
6ECBFDB321E9A31500CBB679 /* DDFileLoggerPerformanceTests.m */,
|
||||
0AA9B47221CC0AE60036182F /* DDFileLoggerTests.m */,
|
||||
B2C90DDE21B9796400A72FD2 /* DDLogFileManagerTests.m */,
|
||||
E9D3C9E21AE28AF400E795C5 /* DDLogMessageTests.m */,
|
||||
E982AAF11AE2C25800088365 /* DDLogTests.m */,
|
||||
C7A5AB042191DB530074B29F /* DDOSLoggingTests.m */,
|
||||
0A55DA2F22CE962F00686977 /* DDSampleFileManager.h */,
|
||||
0A55DA2D22CE962B00686977 /* DDSampleFileManager.m */,
|
||||
0A7E1D55217A7A380011CFEB /* DDSMocking.h */,
|
||||
0A7E1D56217A7A380011CFEB /* DDSMocking.m */,
|
||||
B2C90DDE21B9796400A72FD2 /* DDLogFileManagerTests.m */,
|
||||
0AA9B47221CC0AE60036182F /* DDFileLoggerTests.m */,
|
||||
6ECBFDB321E9A31500CBB679 /* DDFileLoggerPerformanceTests.m */,
|
||||
);
|
||||
path = CocoaLumberjackTests;
|
||||
sourceTree = "<group>";
|
||||
@@ -201,6 +216,7 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
D1CBDE5D2549A686001F63F7 /* PBXTargetDependency */,
|
||||
);
|
||||
name = "OS X Tests";
|
||||
productName = "OS X Tests";
|
||||
@@ -343,11 +359,13 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C76CFC962619EFB900949045 /* DDContextFilterLogFormatter+DeprecatedTests.m in Sources */,
|
||||
0A7E1D57217A7A380011CFEB /* DDSMocking.m in Sources */,
|
||||
0A55DA2E22CE962B00686977 /* DDSampleFileManager.m in Sources */,
|
||||
C7A5AB052191DB530074B29F /* DDOSLoggingTests.m in Sources */,
|
||||
C7A5AB022191DA4D0074B29F /* DDBasicLoggingTests.m in Sources */,
|
||||
E982AAF21AE2C25800088365 /* DDLogTests.m in Sources */,
|
||||
C70461FA260A210B0040853F /* DDContextFilterLogFormatterTests.m in Sources */,
|
||||
6ECBFDB721E9A31500CBB679 /* DDFileLoggerPerformanceTests.m in Sources */,
|
||||
0AA9B47321CC0AE60036182F /* DDFileLoggerTests.m in Sources */,
|
||||
80AC19B12170AC54007800DC /* DDAtomicCounterTests.m in Sources */,
|
||||
@@ -360,11 +378,13 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C76CFC972619EFB900949045 /* DDContextFilterLogFormatter+DeprecatedTests.m in Sources */,
|
||||
0A7E1D58217A86EF0011CFEB /* DDSMocking.m in Sources */,
|
||||
0A0ED26322CEAB290037739B /* DDSampleFileManager.m in Sources */,
|
||||
C7A5AB062191DB530074B29F /* DDOSLoggingTests.m in Sources */,
|
||||
C7A5AB032191DA4D0074B29F /* DDBasicLoggingTests.m in Sources */,
|
||||
E982AAF31AE2C25800088365 /* DDLogTests.m in Sources */,
|
||||
C70461FB260A210B0040853F /* DDContextFilterLogFormatterTests.m in Sources */,
|
||||
6ECBFDB821E9A3BC00CBB679 /* DDFileLoggerPerformanceTests.m in Sources */,
|
||||
0AA9B47721CC0B060036182F /* DDFileLoggerTests.m in Sources */,
|
||||
80AC19B22170AC58007800DC /* DDAtomicCounterTests.m in Sources */,
|
||||
@@ -383,6 +403,14 @@
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
D1CBDE5D2549A686001F63F7 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = CocoaLumberjack;
|
||||
targetProxy = D1CBDE5C2549A686001F63F7 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
432B532A1AAE40EB00843E69 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2020, Deusty, LLC
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
name: CI
|
||||
on:
|
||||
- push
|
||||
- pull_request
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macOS-11
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: swift build
|
||||
@@ -1,2 +1,3 @@
|
||||
xcuserdata
|
||||
project.xcworkspace
|
||||
.build/
|
||||
|
||||
@@ -398,7 +398,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 4.0.0;
|
||||
MARKETING_VERSION = 4.2.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.LaunchAtLogin;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@@ -428,7 +428,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 4.0.0;
|
||||
MARKETING_VERSION = 4.2.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.LaunchAtLogin;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@@ -443,6 +443,7 @@
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
INFOPLIST_FILE = Sources/LaunchAtLoginHelper/Info.plist;
|
||||
@@ -450,6 +451,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.1;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.LaunchAtLoginHelper;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@@ -464,6 +466,7 @@
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
INFOPLIST_FILE = Sources/LaunchAtLoginHelper/Info.plist;
|
||||
@@ -471,6 +474,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.1;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.LaunchAtLoginHelper;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
||||
+17
-4
@@ -9,19 +9,19 @@ public enum LaunchAtLogin {
|
||||
public static let observable = Observable()
|
||||
|
||||
@available(macOS 10.15, *)
|
||||
private static var _publisher = CurrentValueSubject<Bool, Never>(isEnabled)
|
||||
private static let _publisher = CurrentValueSubject<Bool, Never>(isEnabled)
|
||||
@available(macOS 10.15, *)
|
||||
public static var publisher = _publisher.eraseToAnyPublisher()
|
||||
public static let publisher = _publisher.eraseToAnyPublisher()
|
||||
|
||||
private static let id = "\(Bundle.main.bundleIdentifier!)-LaunchAtLoginHelper"
|
||||
|
||||
public static var isEnabled: Bool {
|
||||
get {
|
||||
guard let jobs = (SMCopyAllJobDictionaries(kSMDomainUserLaunchd).takeRetainedValue() as? [[String: AnyObject]]) else {
|
||||
guard let jobs = (LaunchAtLogin.self as DeprecationWarningWorkaround.Type).jobsDict else {
|
||||
return false
|
||||
}
|
||||
|
||||
let job = jobs.first { $0["Label"] as! String == id }
|
||||
let job = jobs.first { ($0["Label"] as? String) == id }
|
||||
|
||||
return job?["OnDemand"] as? Bool ?? false
|
||||
}
|
||||
@@ -65,3 +65,16 @@ extension LaunchAtLogin {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private protocol DeprecationWarningWorkaround {
|
||||
static var jobsDict: [[String: AnyObject]]? { get }
|
||||
}
|
||||
|
||||
extension LaunchAtLogin: DeprecationWarningWorkaround {
|
||||
// Workaround to silence "'SMCopyAllJobDictionaries' was deprecated in OS X 10.10" warning
|
||||
// Radar: https://openradar.appspot.com/radar?id=5033815495933952
|
||||
@available(*, deprecated)
|
||||
static var jobsDict: [[String: AnyObject]]? {
|
||||
SMCopyAllJobDictionaries(kSMDomainUserLaunchd)?.takeRetainedValue() as? [[String: AnyObject]]
|
||||
}
|
||||
}
|
||||
|
||||
+6
-5
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
HELPER_CHECKSUM="6eaaced9173120f82ef98452b2d8cb3705c12db39d4286c70c4f5bb6b67a5e43"
|
||||
HELPER_CHECKSUM_RUNTIME="c5a48f5ba681088aa7922b79f2f1b55a1a006904b8de378790eb0e8b0ac66234"
|
||||
HELPER_CHECKSUM="0a3d09438fb595802d554ce0a7c4ba8e1d2d91d5170362adc965da82e70d74cb"
|
||||
HELPER_CHECKSUM_RUNTIME="98ef556b490e02f4084a11d8a07c33a880177a9816b355885a11f58c95876d62"
|
||||
|
||||
verlte() {
|
||||
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
|
||||
@@ -39,11 +39,12 @@ unzip "$helper_path" -d "$login_items/"
|
||||
defaults write "$login_helper_path/Contents/Info" CFBundleIdentifier -string "$PRODUCT_BUNDLE_IDENTIFIER-LaunchAtLoginHelper"
|
||||
|
||||
if [[ -n $CODE_SIGN_ENTITLEMENTS ]]; then
|
||||
codesign --force --entitlements="$package_resources_path/LaunchAtLogin.entitlements" --options=runtime --sign="$EXPANDED_CODE_SIGN_IDENTITY_NAME" "$login_helper_path"
|
||||
codesign --force --entitlements="$package_resources_path/LaunchAtLogin.entitlements" --deep --options=runtime --sign="$EXPANDED_CODE_SIGN_IDENTITY_NAME" "$login_helper_path"
|
||||
else
|
||||
codesign --force --options=runtime --sign="$EXPANDED_CODE_SIGN_IDENTITY_NAME" "$helper_path"
|
||||
codesign --force --deep --options=runtime --sign="$EXPANDED_CODE_SIGN_IDENTITY_NAME" "$helper_path"
|
||||
fi
|
||||
|
||||
if [[ $CONFIGURATION == "Release" ]]; then
|
||||
# If this is being built for multiple architectures, assume it is a release build and we should clean up.
|
||||
if [[ $ONLY_ACTIVE_ARCH == "NO" ]]; then
|
||||
rm -rf "$contents_path/Resources/LaunchAtLogin_LaunchAtLogin.bundle"
|
||||
fi
|
||||
|
||||
@@ -16,7 +16,8 @@ else
|
||||
codesign --force --options=runtime --sign="$EXPANDED_CODE_SIGN_IDENTITY_NAME" "$helper_path"
|
||||
fi
|
||||
|
||||
if [[ $CONFIGURATION == "Release" ]]; then
|
||||
# If this is being built for multiple architectures, assume it is a release build and we should clean up.
|
||||
if [[ $ONLY_ACTIVE_ARCH == "NO" ]]; then
|
||||
rm -rf "$origin_helper_path"
|
||||
rm "$(dirname "$origin_helper_path")/copy-helper.sh"
|
||||
rm "$(dirname "$origin_helper_path")/LaunchAtLogin.entitlements"
|
||||
|
||||
@@ -11,11 +11,13 @@
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSBackgroundOnly</key>
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import Cocoa
|
||||
import AppKit
|
||||
|
||||
// TODO: When targeting macOS 11, convert this to use `App` protocol and remove `NSPrincipalClass` in Info.plist.
|
||||
|
||||
final class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
func applicationDidFinishLaunching(_ notification: Notification) {
|
||||
let bundleId = Bundle.main.bundleIdentifier!
|
||||
// TODO: Make this more strict by only replacing at the end
|
||||
let mainBundleId = bundleId.replacingOccurrences(of: "-LaunchAtLoginHelper", with: "")
|
||||
let bundleIdentifier = Bundle.main.bundleIdentifier!
|
||||
let mainBundleIdentifier = bundleIdentifier.replacingOccurrences(of: #"-LaunchAtLoginHelper$"#, with: "", options: .regularExpression)
|
||||
|
||||
// Ensure the app is not already running
|
||||
guard NSRunningApplication.runningApplications(withBundleIdentifier: mainBundleId).isEmpty else {
|
||||
// Ensures the app is not already running.
|
||||
guard NSRunningApplication.runningApplications(withBundleIdentifier: mainBundleIdentifier).isEmpty else {
|
||||
NSApp.terminate(nil)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# Maintaining
|
||||
|
||||
## Rebuild helper binaries
|
||||
|
||||
1. If it's the non-`with-runtime` ZIP, set the target to macOS 10.14.4 first.
|
||||
2. Set build configuration to “Release”.
|
||||
3. Build the binary.
|
||||
4. Find the binary in “Products” in the sidebar, ZIP it, and overwrite the existing ZIP file in the source directory.
|
||||
5. Run `shasum -a 256 filename.zip` on the ZIP file and copy the hash into “copy-helper-swiftpm.sh”.
|
||||
+46
-12
@@ -6,6 +6,35 @@ It's usually quite a [convoluted and error-prone process](before-after.md) to ad
|
||||
|
||||
This package works with both sandboxed and non-sandboxed apps and it's App Store compatible and used in apps like [Plash](https://github.com/sindresorhus/Plash), [Dato](https://sindresorhus.com/dato), [Lungo](https://sindresorhus.com/lungo), and [Battery Indicator](https://sindresorhus.com/battery-indicator).
|
||||
|
||||
<br>
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<p>
|
||||
<p>
|
||||
<sup>
|
||||
<a href="https://github.com/sponsors/sindresorhus">Sindre‘s open source work is supported by the community</a>
|
||||
</sup>
|
||||
</p>
|
||||
<sup>Special thanks to:</sup>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://keygen.sh">
|
||||
<div>
|
||||
<img src="https://sindresorhus.com/assets/thanks/keygen-logo.svg" width="210" alt="Keygen">
|
||||
</div>
|
||||
<b>A dead-simple software licensing and distribution API built for developers</b>
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
<br>
|
||||
|
||||
## Requirements
|
||||
|
||||
- macOS 10.12+
|
||||
@@ -16,11 +45,7 @@ This package works with both sandboxed and non-sandboxed apps and it's App Store
|
||||
|
||||
#### Swift Package Manager
|
||||
|
||||
Xcode 12+ required.
|
||||
|
||||
```
|
||||
.package(url: "https://github.com/sindresorhus/LaunchAtLogin", from: "4.0.0")
|
||||
```
|
||||
Add `https://github.com/sindresorhus/LaunchAtLogin` in the [“Swift Package Manager” tab in Xcode](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app).
|
||||
|
||||
#### Carthage
|
||||
|
||||
@@ -32,20 +57,26 @@ github "sindresorhus/LaunchAtLogin"
|
||||
|
||||
## Usage
|
||||
|
||||
Add a new ["Run Script Phase"](http://stackoverflow.com/a/39633955/64949) **below** "Embed Frameworks" in "Build Phases" with the following:
|
||||
|
||||
#### Swift Package Manager
|
||||
|
||||
Add a new [“Run Script Phase”](http://stackoverflow.com/a/39633955/64949) **below** (not into) “Copy Bundle Resources” in “Build Phases” with the following:
|
||||
|
||||
```sh
|
||||
"${BUILT_PRODUCTS_DIR}/LaunchAtLogin_LaunchAtLogin.bundle/Contents/Resources/copy-helper-swiftpm.sh"
|
||||
```
|
||||
|
||||
*(I would name the run script `Copy “Launch at Login Helper”`)*
|
||||
|
||||
#### Carthage
|
||||
|
||||
Add a new [“Run Script Phase”](http://stackoverflow.com/a/39633955/64949) **below** (not into) “Embed Frameworks” in “Build Phases” with the following:
|
||||
|
||||
```sh
|
||||
"${PROJECT_DIR}/Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh"
|
||||
```
|
||||
|
||||
*(I would name the run script `Copy “Launch at Login Helper”`)*
|
||||
|
||||
### Use it in your app
|
||||
|
||||
No need to store any state to UserDefaults.
|
||||
@@ -143,7 +174,7 @@ final class ViewController: NSViewController {
|
||||
|
||||
## How does it work?
|
||||
|
||||
The framework bundles the helper app needed to launch your app and copies it into your app at build time.
|
||||
The package bundles the helper app needed to launch your app and copies it into your app at build time.
|
||||
|
||||
## FAQ
|
||||
|
||||
@@ -186,17 +217,20 @@ Some helpful Stack Overflow answers:
|
||||
|
||||
#### Can you support CocoaPods?
|
||||
|
||||
CocoaPods used to be supported, but [it did not work well](https://github.com/sindresorhus/LaunchAtLogin/issues/22) and there was no easy way to fix it, so support was dropped. Even though you mainly use CocoaPods, you can still use Carthage just for this package without any problems.
|
||||
CocoaPods used to be supported, but [it did not work well](https://github.com/sindresorhus/LaunchAtLogin/issues/22) and there was no easy way to fix it, so support was dropped. Even though you mainly use CocoaPods, you can still use Swift Package Manager just for this package without any problems.
|
||||
|
||||
#### I'm getting a `'SMCopyAllJobDictionaries' was deprecated in OS X 10.10` warning
|
||||
#### I can't see the `LaunchAtLogin.bundle` in my debug build or I get a notarization error for developer ID distribution
|
||||
|
||||
Apple deprecated that API without providing an alternative. Apple engineers have [stated that it's still the preferred API to use](https://github.com/alexzielenski/StartAtLoginController/issues/12#issuecomment-307525807). I plan to use it as long as it's available. There are workarounds I can implement if Apple ever removes the API, so rest assured, this module will be made to work even then. If you want to see this resolved, submit a [Feedback Assistant](https://feedbackassistant.apple.com) report with [the following text](https://github.com/feedback-assistant/reports/issues/16). There's unfortunately still [no way to suppress warnings in Swift](https://stackoverflow.com/a/32861678/64949).
|
||||
As discussed [here](https://github.com/sindresorhus/LaunchAtLogin/issues/50), this package tries to determine if you're making a release or debug build and clean up its install accordingly. If your debug build is missing the bundle or, conversely, your release build has the bundle and it causes a code signing error, that means this has failed.
|
||||
|
||||
The script's determination is based on the “Build Active Architecture Only” flag in build settings. If this is set to `YES`, then the script will package LaunchAtLogin for a debug build. You must set this flag to `NO` if you plan on distributing the build with codesigning.
|
||||
|
||||
## Related
|
||||
|
||||
- [Defaults](https://github.com/sindresorhus/Defaults) - Swifty and modern UserDefaults
|
||||
- [Preferences](https://github.com/sindresorhus/Preferences) - Add a preferences window to your macOS app in minutes
|
||||
- [KeyboardShortcuts](https://github.com/sindresorhus/KeyboardShortcuts) - Add user-customizable global keyboard shortcuts to your macOS app
|
||||
- [Regex](https://github.com/sindresorhus/Regex) - Swifty regular expressions
|
||||
- [Preferences](https://github.com/sindresorhus/Preferences) - Add a preferences window to your macOS app in minutes
|
||||
- [DockProgress](https://github.com/sindresorhus/DockProgress) - Show progress in your app's Dock icon
|
||||
- [create-dmg](https://github.com/sindresorhus/create-dmg) - Create a good-looking DMG for your macOS app in seconds
|
||||
- [More…](https://github.com/search?q=user%3Asindresorhus+language%3Aswift)
|
||||
|
||||
-3
@@ -3,9 +3,6 @@ import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "SwiftyJSON",
|
||||
platforms: [
|
||||
.macOS(.v10_10), .iOS(.v8), .tvOS(.v9), .watchOS(.v3)
|
||||
],
|
||||
products: [
|
||||
.library(name: "SwiftyJSON", targets: ["SwiftyJSON"])
|
||||
],
|
||||
|
||||
+1
-3
@@ -28,8 +28,6 @@ Platform | Build Status
|
||||
6. [Work with Moya](#work-with-moya)
|
||||
7. [SwiftyJSON Model Generator](#swiftyjson-model-generator)
|
||||
|
||||
> [中文介绍](http://tangplin.github.io/swiftyjson/)
|
||||
|
||||
|
||||
## Why is the typical JSON handling in Swift NOT good?
|
||||
|
||||
@@ -466,7 +464,7 @@ If both JSONs contain a value for the same key, _mostly_ this value gets overwri
|
||||
- In case of both values being a `JSON.Type.array` the values form the array found in the `other` JSON getting appended to the original JSON's array value.
|
||||
- In case of both values being a `JSON.Type.dictionary` both JSON-values are getting merged the same way the encapsulating JSON is merged.
|
||||
|
||||
In case, where two fields in a JSON have a different types, the value will get always overwritten.
|
||||
In a case where two fields in a JSON have different types, the value will get always overwritten.
|
||||
|
||||
There are two different fashions for merging: `merge` modifies the original JSON, whereas `merged` works non-destructively on a copy.
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "SwiftyJSON"
|
||||
s.version = "4.3.0"
|
||||
s.version = "5.0.1"
|
||||
s.summary = "SwiftyJSON makes it easy to deal with JSON data in Swift"
|
||||
s.homepage = "https://github.com/SwiftyJSON/SwiftyJSON"
|
||||
s.license = { :type => "MIT" }
|
||||
@@ -9,7 +9,7 @@ Pod::Spec.new do |s|
|
||||
s.requires_arc = true
|
||||
s.swift_version = "5.0"
|
||||
s.osx.deployment_target = "10.9"
|
||||
s.ios.deployment_target = "8.0"
|
||||
s.ios.deployment_target = "9.0"
|
||||
s.watchos.deployment_target = "3.0"
|
||||
s.tvos.deployment_target = "9.0"
|
||||
s.source = { :git => "https://github.com/SwiftyJSON/SwiftyJSON.git", :tag => s.version }
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user