{"action":"created","issue":{"url":"https://api.github.com/repos/RestKit/RestKit/issues/2264","labels_url":"https://api.github.com/repos/RestKit/RestKit/issues/2264/labels{/name}","comments_url":"https://api.github.com/repos/RestKit/RestKit/issues/2264/comments","events_url":"https://api.github.com/repos/RestKit/RestKit/issues/2264/events","html_url":"https://github.com/RestKit/RestKit/pull/2264","id":100341382,"number":2264,"title":"Put CocoaLumberjack Logging into separate subspec (Fixes Issue #2262)","user":{"login":"timbodeit","id":4222754,"avatar_url":"https://avatars.githubusercontent.com/u/4222754?v=3","gravatar_id":"","url":"https://api.github.com/users/timbodeit","html_url":"https://github.com/timbodeit","followers_url":"https://api.github.com/users/timbodeit/followers","following_url":"https://api.github.com/users/timbodeit/following{/other_user}","gists_url":"https://api.github.com/users/timbodeit/gists{/gist_id}","starred_url":"https://api.github.com/users/timbodeit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timbodeit/subscriptions","organizations_url":"https://api.github.com/users/timbodeit/orgs","repos_url":"https://api.github.com/users/timbodeit/repos","events_url":"https://api.github.com/users/timbodeit/events{/privacy}","received_events_url":"https://api.github.com/users/timbodeit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-11T15:40:55Z","updated_at":"2015-11-03T03:40:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/RestKit/RestKit/pulls/2264","html_url":"https://github.com/RestKit/RestKit/pull/2264","diff_url":"https://github.com/RestKit/RestKit/pull/2264.diff","patch_url":"https://github.com/RestKit/RestKit/pull/2264.patch"},"body":"Previously `RKLumberjackLogger` was used automatically if CocoaLumberjack is present.\r\nThis was realized by checking if the `DDLog.h` Header file is available. This approach works great with static libraries, but is problematic when building RestKit as a framework.\r\n\r\nWhen built as a framework, RestKit needs to be explicitly linked against CocoaLumberjack. Otherwise it will find the Header files, but fail at the linking stage.\r\n\r\nMy Approach:\r\nMoving `RKLumberjackLogger` into a separate subspec (RestKit/CocoaLumberjack).  \r\nInside that subspec also setting a preprocessor macro `RKLOG_USE_COCOALUMBERJACK`, similar to the one already in place `RKLOG_USE_NSLOGGER`.  \r\nOnly using CocoaLumberjack for logging, if that macro is set.\r\n\r\nThis fixes the problems when using cocoapods `use_frameworks!` options, that I described in issue #2262 .\r\n\r\nProblems:\r\n- Introducing the subspec and macro will change RestKits behavior in existing projects (even when static libraries are used).\r\n- **`[RESOLVED]`** RestKit currently uses old 1.9.x CocoaLumberjack API (see #2263 ).  \r\n_Adding it as an explicit dependency in a subspec causes `pod lib lint` to show three resulting errors, that would previously show up at a later stage (when RestKit and Cocoalumberjack together are included in a project)._"},"comment":{"url":"https://api.github.com/repos/RestKit/RestKit/issues/comments/153232273","html_url":"https://github.com/RestKit/RestKit/pull/2264#issuecomment-153232273","issue_url":"https://api.github.com/repos/RestKit/RestKit/issues/2264","id":153232273,"user":{"login":"timbodeit","id":4222754,"avatar_url":"https://avatars.githubusercontent.com/u/4222754?v=3","gravatar_id":"","url":"https://api.github.com/users/timbodeit","html_url":"https://github.com/timbodeit","followers_url":"https://api.github.com/users/timbodeit/followers","following_url":"https://api.github.com/users/timbodeit/following{/other_user}","gists_url":"https://api.github.com/users/timbodeit/gists{/gist_id}","starred_url":"https://api.github.com/users/timbodeit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timbodeit/subscriptions","organizations_url":"https://api.github.com/users/timbodeit/orgs","repos_url":"https://api.github.com/users/timbodeit/repos","events_url":"https://api.github.com/users/timbodeit/events{/privacy}","received_events_url":"https://api.github.com/users/timbodeit/received_events","type":"User","site_admin":false},"created_at":"2015-11-03T03:40:51Z","updated_at":"2015-11-03T03:40:51Z","body":"@segiddins If you find the time for it, it would be awesome if you could take another look at this pull request and give me some feedback on it.\r\n\r\nI've thought some more about the problem with the behavior changes compared to previous versions.\r\n\r\nI could only come up with two options. Maybe you might have a better idea how to solve this:\r\n\r\n##### 1. Move CocoaLumberjack related code to subspec and use `RKLOG_USE_COCOALUMBERJACK` macro.\r\n  **Pros:**\r\n    - Might be better for people using frameworks and not using CocoaPods. If they don't want to use CocoaLumberjack, they don't have to worry about linking RestKit against it.\r\n    - Consistent with `RKLOG_USE_NSLOGGER`\r\n\r\n  **Cons:**\r\n    - Changes behavior for everybody using RestKit as a static library. They have to add \"RestKit/CocoaLumberjack\" to their Podfile if they want RestKit to keep logging into Lumberjack.\r\n##### 2. Move CocoaLumberjack related code to subspec and decide based on availability of `RKLumberjackLogger.h` (which is part of the subspec)\r\n  **Pros:**\r\n    - Doesn't change behavior for people using RestKit as a static library without CocoaPods  \r\n\r\n  **Cons:**\r\n    - Still changes behavior for people using RestKit as a static library with CocoaPods. They have to add \"RestKit/CocoaLumberjack\" to their Podfile if they want RestKit to keep logging into Lumberjack.\r\n    - People using RestKit as a framework without CocoaPods could still face issues, when not linking it against CocoaLumberjack.\r\n\r\n---\r\n\r\nAs I said: Those were the only two solutions I could come up with. Any better suggestions are highly appreciated.\r\n\r\nNonetheless, I believe the ability to use CocoaLumberjack and RestKit (together) as frameworks with CocoaPods overweights the mentioned drawbacks. Especially since frameworks are becoming increasingly relevant over static libraries.\r\n\r\nCurrently it is not possible to integrate CocoaLumberjack and RestKit as framworks into the same project without making additional modifications after running `pod install`."}}