2

I am building an app with Sencha Touch 2.

I want to log some messages, but I do not want to litter my code with console.log all over the place, so I would like to know more about Ext.Logger. As I understand it, this class is in sencha-touch-debug.js but is NOT in sencha-touch.js (The file that is used in the production build)

How then am I supposed to use Ext.Logger? I would assume this is your typical logging class, i.e, log some useful messages at development time, then in the production build configure it so that its quiet.

But if the Ext.Logger class is NOT in the production build then what good is it? Are references to it removed at build time? Is there some configuration I am supposed to specify?

I cannot seem to find any documentation on this class, or how its supposed to be used.

btantlinger
  • 803
  • 8
  • 11

1 Answers1

5

I had the same problem and the documentation for Ext.Logger is really poor.

Unfortunately it seems you cannot use it for production. According to a thread in the Sencha Touch forum, Ext.Logger is supposed to be used only for debugging during development. That's why it's only included in sencha-touch-debug.js and not sencha-touch.js.

Tobias
  • 2,089
  • 2
  • 26
  • 51
  • hi Tobias, thank you for the answer. Do you have any idea what should we use actually for production... ? – Nathan Do Jul 01 '13 at 09:20
  • @NathanDo: You can use `console.log`. As not every (especially older) browser supports it, first check if it's available: `if (window.console && console.log) { console.log('Log output'); }`. See also this thread for details: http://stackoverflow.com/questions/4539253/what-is-console-log – Tobias Jul 01 '13 at 09:35