fix(log): Allow passing optional params for logs#9456
fix(log): Allow passing optional params for logs#9456NathanWalker merged 3 commits intoNativeScript:masterfrom jdnichollsc:master
Conversation
|
@jdnichollsc awesome PR! |
| export function log(message: string, ...optionalParams: any[]): void { | ||
| if ((<any>global).__nslog) { | ||
| (<any>global).__nslog('CONSOLE LOG: ' + message); | ||
| (<any>global).__nslog('CONSOLE LOG: ' + message, ...optionalParams); |
There was a problem hiding this comment.
Given this passes through NSLog, not sure if we need to define an override (in the ios runtime) as mentioned here:
https://stackoverflow.com/a/42674570
@rigor789 may know?
The console.log below definitely makes sense and shouldn't be an issue but the __nslog, I'm not sure.
There was a problem hiding this comment.
Looks like here it's a single string arg: https://github.com/NativeScript/ns-v8ios-runtime/blob/master/AppWithModules/Frameworks/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers/TNSProcess.h#L27
@jdnichollsc did you try this running against latest @nativescript/ios 8.0.0? just curious if you found the optionalParams additions make it through the global.__nslog okay?
There was a problem hiding this comment.
You're right! NSLog only works with one argument 🤦
There was a problem hiding this comment.
Excellent thanks for updating!
PR Checklist
What is the current behavior?
Important logs don't accept other arguments.
What is the new behavior?
Allow passing arguments for important logs
Fixes/Implements/Closes #8657.
Thanks for your collaboration! <3