Skip to content

Add OSLog support to SFSDKLogger #271

Merged
bbirman merged 2 commits intoforcedotcom:devfrom
TheAlmightyBob:OSLog
Oct 21, 2025
Merged

Add OSLog support to SFSDKLogger #271
bbirman merged 2 commits intoforcedotcom:devfrom
TheAlmightyBob:OSLog

Conversation

@TheAlmightyBob
Copy link
Copy Markdown
Contributor

Summary

OSLog provides more modern console logging than the existing mechanism used by SFSDKLogger, with distinct log entries, status coloring, and filterable metadata.

The underlying CocoaLumberjack already supports it (in fact, it actually logs a warning if you're still using the old logger), so this PR simply provides the option to enable it. It still defaults to the existing behavior to be safe.

Details

  • New useOSLog class property on SFSDKLogger. Defaults to NO. Must be set prior to creating logger instances.
    • (assumption is that you wouldn't want the logging mechanism to change mid-log anyway)
  • If enabled, console logs will use OSLog to provide distinct log lines with metadata instead of the previous plain text logging method
  • Updated the previously-empty SalesforceFileLoggerTestApp to log a few messages with/without OSLog
image

@salesforce-cla
Copy link
Copy Markdown

salesforce-cla bot commented Aug 9, 2025

Thanks for the contribution! Before we can merge this, we need @TheAlmightyBob to sign the Salesforce Inc. Contributor License Agreement.

@TheAlmightyBob
Copy link
Copy Markdown
Contributor Author

I tried to sign the CLA and it returned an error. If I try again it says I already signed...

- New "useOSLog" class property on SFSDKLogger. Defaults to "NO" to preserve existing behavior. Must be set prior to creating logger instances.
- If enabled, console logs will use OSLog to provide distinct log lines with metadata instead of the previous plain text logging method
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 17, 2025

Codecov Report

❌ Patch coverage is 86.95652% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.08%. Comparing base (d88e75b) to head (1d95755).
⚠️ Report is 9 commits behind head on dev.

Files with missing lines Patch % Lines
.../SalesforceFileLogger/Classes/Logger/SFSDKLogger.m 84.21% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #271      +/-   ##
==========================================
+ Coverage   61.39%   63.08%   +1.68%     
==========================================
  Files          21       21              
  Lines        1816     1834      +18     
==========================================
+ Hits         1115     1157      +42     
+ Misses        701      677      -24     
Flag Coverage Δ
SalesforceFileLogger 70.55% <86.95%> (+10.16%) ⬆️
SalesforceHybridSDK 61.47% <ø> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../SalesforceFileLoggerTestApp/Classes/AppDelegate.m 63.63% <100.00%> (+20.77%) ⬆️
.../SalesforceFileLogger/Classes/Logger/SFSDKLogger.m 65.41% <84.21%> (+12.23%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bbirman bbirman merged commit 88f093a into forcedotcom:dev Oct 21, 2025
19 of 20 checks passed
@TheAlmightyBob TheAlmightyBob deleted the OSLog branch October 21, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants