How do you manage your print/asserts()?

How do everyone handle their print/assert() when app goes live in the stores?

I just use a flag to check if my app is beta, like this;

local appIsBeta = true;  
  
if appIsBeta == true then  
 print()  
 assert()  
end  

then I just change the flag to false so I don’t have to go through the code and comment/erase every print before submitting.

I read something about print() in an article some time ago that apps could get rejected by Apple if the prints were actually printing to console.

Does anyone have a use a printController class or something similar for easier management of this?

Open for suggestions
@lano78

[import]uid: 13560 topic_id: 20360 reply_id: 320360[/import]

i just press ctrl+f and search for print() in file than i replace them all with --print or blank space, done) [import]uid: 16142 topic_id: 20360 reply_id: 79538[/import]

@lano78 - Define your own global assert and print functions and have a global flag for disabling and enabling the print/assert in that function. [import]uid: 84539 topic_id: 20360 reply_id: 79564[/import]

Aha, and what about you forgetting to remove some “print()”?

PS: BTW I did that and my new app is waiting for review already. So I can report you guys here after this anxious momment.
Cheers,
Rodrigo. [import]uid: 89165 topic_id: 20360 reply_id: 79565[/import]

I leave prints in my submissions. I just make sure big dumpers get commented out. [import]uid: 19626 topic_id: 20360 reply_id: 79575[/import]

Ehhh… @rob! Thank you for sharing this info mate! At least I can sleepy less stressed tonight. :slight_smile:

PS: BTW my forgotten print() statements there are not SO hard I think. It would print only things like: "Im using simulator"/"Build for device to get maps displayed"...etc. SO i think, BETTER, I hope it does not harm so much the beautiful Apples mind. :\

Cheers,
Rodrigo. [import]uid: 89165 topic_id: 20360 reply_id: 79588[/import]

Yeah, my apps and games have had print lines still in them and they got approved. I think they don’t like it printing like 500 lines xD

Regards,
Jordan Schuetz
Ninja Pig Studios [import]uid: 29181 topic_id: 20360 reply_id: 79605[/import]

Rodrigo, don’t worry - Apple don’t reject because of print statements. (Or at least they never have in my case.)

I’m better these days but I used to frequently leave print statements in my final builds - often a lot of them. You have nothing to worry about so long as you aren’t printing ridiculous amounts, as Jordan said :slight_smile:

Peach [import]uid: 52491 topic_id: 20360 reply_id: 79661[/import]

Thank you very Much @Peach, @Jordan, @Lano, @bejoy, @darkconsoles & @robmiracle for confirming all of this. Less bad after listening to all of this experiences. :slight_smile:

Cheers friends,
Rodrigo. [import]uid: 89165 topic_id: 20360 reply_id: 79663[/import]

Happy to hear it Rodrigo - don’t worry, soon you will have many apps in the store and will be used to all of this.

Peach :slight_smile: [import]uid: 52491 topic_id: 20360 reply_id: 79688[/import]

Ha, ha, @Peach! Very honestly - Thank you for the confidence and I just hope so! :wink:
Cheers,
Rodrigo. [import]uid: 89165 topic_id: 20360 reply_id: 79697[/import]

the reason I do it like I said is because in development I use developer emails, phoneNumbs, urls etc and by using the appIsBeta then everything in my apps switch to client info when I change the flag to false.

It works great for me. [import]uid: 13560 topic_id: 20360 reply_id: 79720[/import]

It’s great to know. Thanks for the info, everyone! I was going to go through every file and remove all print statements manually (which was one of the final things to do) – but it seems like there are a few different ways to go about handling this (and an option not to do anything about it too…)

Good luck with your app, Rodrigo!

Naomi [import]uid: 67217 topic_id: 20360 reply_id: 79775[/import]

My favorite suggestion was CRTL+F for “print” and replace with “–print”, that seems like a very handy way of managing things :slight_smile: [import]uid: 52491 topic_id: 20360 reply_id: 79793[/import]

I agree, Peach. @darkconsoles’ suggestion is my top pick too. But I also thought @lano78’s method would come in handy at some point. And then, even if I miss some print statements (or at the last mad rush, forget all about dealing with print statements), it’s a relief to know I don’t need to feel too nervous.

Cheers,
Naomi [import]uid: 67217 topic_id: 20360 reply_id: 79816[/import]

Hey, Thank You @Naomi! Nice to get positive vibrations! :slight_smile:
Cheers,
Rodrigo. [import]uid: 89165 topic_id: 20360 reply_id: 79870[/import]

In v3 of Corona Project Manager there’s an option for when you Publish (do a final build) that will kill all the print statements in your .lua files. So if you always want those stripped, just turn on that preference and never think about it again. You’ll have print() when you’re working on your project, but not when you publish.

v3 is due in Q1/2012 and will be a free upgrade for existing customers.

If you’re not using CPM, creating a global print function makes a lot of sense – switch a flag and it’s no longer active. Of course, the code is still there in your published app, but it probably doesn’t add enough extra baggage to really worry about.

Jay [import]uid: 9440 topic_id: 20360 reply_id: 82599[/import]

@jay
Sounds great, looking forward to the update.

While I’m at it, there’s a console command that let you see the print’s when testing on device. It was sort of a little dirty hack with wifi print to console or something similar, I can’t seem to find it when searching the forum…

I’m doing a lot of testing with stuff only available on device but I need to see what the console say while testing it.

Anyone know or remember how to get that print from device to corona terminal?

[import]uid: 13560 topic_id: 20360 reply_id: 82620[/import]

Here’s one way you can use print() from a device, but it doesn’t show up in the terminal:

http://gamedevnation.com/corona-sdk-video-tutorials/using-print-from-a-device-kinda/

I do seem to remember some other way but can’t think of it right now.

Jay
[import]uid: 9440 topic_id: 20360 reply_id: 82624[/import]

I remember, it was called netcat. So much easier to search for now…

Here’s the link. [import]uid: 13560 topic_id: 20360 reply_id: 82691[/import]