-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(log): Allow passing optional params for logs #9456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@jdnichollsc awesome PR! |
packages/core/profiling/index.ts
Outdated
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! NSLog only works with one argument 🤦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent thanks for updating!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're welcome!
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