BranchMetrics / ios-branch-deep-linking-attribution

The Branch iOS SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://help.branch.io/developers-hub/docs/ios-sdk-overview
MIT License
731 stars 228 forks source link

SDK-2239 clean up logs #1372

Closed echo-branch closed 5 months ago

echo-branch commented 5 months ago

Reference

SDK-2239 clean up logs

Summary

  1. Reduce log noise by adjusting log levels of log message and simplifying the log message.
  2. Allow NSError to be passed at any log level. This handles situations where NSError may be common, such as no network.
  3. Make enableLogging a static method to capture SDK init issues. Deprecate the older instance versions, they still work though.
  4. Unwrap network NSErrors so it's easier to determine the root cause.
  5. Add a helper method to check if a Network NSError looks like an Ad blocker.
  6. Remove commented out test cases.

Motivation

With switch to os_log, we noticed that logs were very noisy with inappropriate log levels for some logs. This is mainly reduce noise and make SDK debugging easier.

Type Of Change

Testing Instructions

All changes should be compatible with existing logging.

For testing with a DNS ad blocker, the device should route calls through Pi-hole or a similar application. The SDK should log a warning indicating that some calls are likely blocked.

cc @BranchMetrics/saas-sdk-devs for visibility.

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 53.44828% with 162 lines in your changes are missing coverage. Please review.

Project coverage is 51.03%. Comparing base (1b03a81) to head (4152af5). Report is 14 commits behind head on master.

Files Patch % Lines
Sources/BranchSDK/BNCEncodingUtils.m 77.38% 13 Missing and 6 partials :warning:
Sources/BranchSDK/BNCServerInterface.m 51.51% 15 Missing and 1 partial :warning:
Sources/BranchSDK/BranchLogger.m 70.58% 13 Missing and 2 partials :warning:
Sources/BranchSDK/NSError+Branch.m 0.00% 15 Missing :warning:
Sources/BranchSDK/BNCApplication.m 44.00% 11 Missing and 3 partials :warning:
Sources/BranchSDK/Branch.m 55.55% 12 Missing :warning:
Sources/BranchSDK/BNCURLFilter.m 0.00% 10 Missing :warning:
Sources/BranchSDK/BranchQRCode.m 23.07% 10 Missing :warning:
Sources/BranchSDK/BranchOpenRequest.m 18.18% 9 Missing :warning:
Sources/BranchSDK/BNCPreferenceHelper.m 46.66% 8 Missing :warning:
... and 14 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1372 +/- ## ========================================== - Coverage 51.27% 51.03% -0.25% ========================================== Files 66 66 Lines 10092 10126 +34 Branches 3697 3714 +17 ========================================== - Hits 5175 5168 -7 - Misses 4654 4700 +46 + Partials 263 258 -5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.