Capturing debug messages
There are a few helper functions that are available to enable you to send out debug messages from the app.
Function |
Description |
---|---|
Ti.API.debug('text') Or console.debug('text')
|
Write a message to the console at the debug level. |
Ti.API.warn('text') Or console.warn('text')
|
Write a message to the console at the warn level. These messages are colored yellow. |
alert('text')
|
Displays an alert box with the text and a single OK button. |
Tip
Debugging code should be removed from your code or disabled before you go live. They are unlikely to result in your app submission being rejected, but the same messages that appear on the console in Titanium will be logged to the log files on your device. You don't want a clever developer snooping on your debug messages when the app is live.
Note
Note that by default debug messages will not appear on the console. The default log level is to record errors and warnings. This can be altered by navigating to the Run | Run Configurations...