2016-04-11 11 views

Antwort

3

Nein, sie sind immer noch hier, guter Mann Fokke hat ein schönes Modul, ti-stealth, das funktioniert diese Arbeit für Sie.

+0

Danke für die Info, aufgefordert, mich mit einer schnellen und schmutzigen Lösung zu kommen, siehe meine Antwort unten. – Dooderoo

1

quick and dirty Lösung keine Nachrichten in der Produktion log:

Wrap Ti.API.log in einer Funktion in alloy.js:

function log (msg) { 
    if (Alloy.CFG.debugging) { 
     Ti.API.log('>>> ' + msg); 
    } 
} 

log("My logged message"); 

Fügen debugging Schlüssel in config.son:

{ 
    "global": {}, 
    "env:development": { 
     "debugging":true 
    }, 
    "env:test": { 
     "debugging":true 
    }, 
    "env:production": { 
     "debugging":false 
    } 
} 
1

Schnell und schmutzig, aber funktioniert: In alloy.js

function consLog(e) 
{ 
    if (!ENV_PRODUCTION) 
     console.log(JSON.stringify(e)); 
} 

Und es verwendet:

consLog("Hello World"); 
+0

Dies ist nicht schnell und schmutzig. Weitere Informationen finden Sie hier: http://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Controllers-section-34636384_AlloyControllers-ConditionalCode – Garre