Use NSLog when printing on the device #10
Closed
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.
This PR updates
Kernel#mp()
to use NSLog when running on the device as discussed in #6It basically just splits on newlines the output that would have been printed using
puts
on the simulator and prints each line using NSLog. I was skeptical this would work initially, but it seems to work pretty well in my limited testing.I took the guts of
MotionPrint.simulator?
directly from BubbleWrap::Device, and it should be cached as a class instance variable and thus be pretty lightweight to call in repeated calls toKernel#mp()
. I added a spec forMotionPrint.simulator?
that passes on both the simulator and the device. However, I have no idea how to test the actual NSLog part. I didn't want to add a mocking/stubbing library, and I'm pretty sure NSLog would be a hard thing to stub/spy on, regardless. Suggestions welcome on that front.Anyway, please take a look and let me know if this is something worth pursuing.
Cheers,
Mark