Fix TracksLogWarn
messages aren't logged with Cocoapods integration
#263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #262
Why
Recently, we noticed a Tracks event wasn't actually tracked due to a validation error that wasn't logged anywhere in the console p1693362956666449/1692625489.705669-slack-C039133E1M3 / woocommerce/woocommerce-ios#10574.
Automattic-Tracks-iOS/Sources/Event Logging/TracksEventService.m
Lines 59 to 61 in aad902b
Upon inspection,
TracksLoggingClass()
isnil
when the library is integrated with the client app via Cocoapods:Automattic-Tracks-iOS/Sources/Model/ObjC/Common/TracksLogging.m
Lines 6 to 18 in aad902b
I'm guessing the Cocoapods path wasn't tested, and thus Tracks logging has been disabled for a while.
How
To fix the
nil
TracksLoggingClass()
, the logging class was updated to include the module name so that the class can be loaded correctly 7dd7d5d.For easier debugging, the event name is now included in the warning message when there is a validation error creating a Tracks event bce4ea9.
To enable the client app to log a different message on Tracks event creation error, a success boolean is returned when creating an event with custom properties a9bfbbc. The return value is default to be discardable in Objective-C.
Testing steps
Please follow the testing steps in woocommerce/woocommerce-ios#10577.
CHANGELOG.md
if necessary.