Skip to content
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

Print statements (Logs) #1021

Closed
madhikarma opened this issue May 11, 2016 · 5 comments
Closed

Print statements (Logs) #1021

madhikarma opened this issue May 11, 2016 · 5 comments

Comments

@madhikarma
Copy link

madhikarma commented May 11, 2016

Hello there

Thanks for creating this library. I was wondering about some of the print and Swift.print statements in the code base (mainly for tracking unhappy paths).

Are those printed for Release builds too?

If we wanted to disable those print statements or allow people to enable or disable them what would be the best way?

Ideas: I'm thinking something like a ChartsLogger class with a print or log method. Also an enabled parameter that can be configured by apps that use the framework?

Let me know if this is something you'd be willing to accept a contribution for (or not) also whether it's being worked on already?

Thank you

@madhikarma madhikarma changed the title Customize / Disable Log statements Print statements (Logs) May 11, 2016
@pmairoldi
Copy link
Collaborator

Swift's print function does not print on release builds.

@pmairoldi
Copy link
Collaborator

These logs are mainly for the developer to know they have done something wrong during development. I don't really see a point in adding the complexity of a logging interface for something that will never effect release builds.

@madhikarma
Copy link
Author

Great thanks! I didn't know that Swift print statements aren't there on release builds. Do you have a link to any docs for this or have you been able to verify it?

If this is the case totally agree that it's not necessary to wrap this (although I don't think it adds much more complexity).

I'll try and test this out sometime myself but thanks for getting back to me.

@pmairoldi
Copy link
Collaborator

I ran into this when trying to implement VoIP notifications for an app. I was trying to print the token to the device logs while in release mode to manually send notifications to the phone but it wouldn't work unless I use NSLog. I wrote about it here

@pmairoldi
Copy link
Collaborator

To try it out run something with print ans NSLog on a device. Kill the debugger and rerun the app. Go to window > devices in Xcode and click the device. You shoul see all the devices log there. Search for you app name there and you will only see 1 log which is from NSLog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants