| 1 |
define(["dojo/_base/declare", "dojo/dom", "dojo/dom-style", |
| 2 |
"dojo/dom-class", "dojo/dom-attr", "dojo/dom-construct", "dojo/_base/config", "dojo/sniff", |
| 3 |
"dojox/app/Controller"], |
| 4 |
function (declare, dom, domStyle, domClass, domAttr, domConstruct, dconfig, has, Controller){ |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
return declare(Controller, { |
| 12 |
|
| 13 |
constructor: function (app){ |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
app.appLogging=app.appLogging || {}; |
| 21 |
app.appLogging.loggingList=app.appLogging.loggingList || []; |
| 22 |
|
| 23 |
has.add("app-log-api", ((dconfig["app"] || {}).debugApp) || app.appLogging["logAll"]); |
| 24 |
has.add("app-log-partial", app.appLogging.loggingList.length > 0); |
| 25 |
|
| 26 |
if(has("app-log-api") || has("app-log-partial")){ |
| 27 |
app.log=function (){ |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
var msg=""; |
| 36 |
if(app.appLogging.logTimeStamp){ |
| 37 |
msg=msg + new Date().getTime() + " "; |
| 38 |
} |
| 39 |
if(has("app-log-api") || app.appLogging["logAll"]){ |
| 40 |
try{ |
| 41 |
for(var i=0; i < arguments.length - 1; i++){ |
| 42 |
msg=msg + arguments[i] + " "; |
| 43 |
} |
| 44 |
console.log(msg, arguments[arguments.length - 1]); |
| 45 |
} catch (e){ |
| 46 |
} |
| 47 |
} else if(has("app-log-partial")){ |
| 48 |
try{ |
| 49 |
if(app.appLogging.loggingList.indexOf(arguments[0]) > -1){ |
| 50 |
for(var i=2; i < arguments.length - 1; i++){ |
| 51 |
msg=msg + arguments[i]; |
| 52 |
} |
| 53 |
console.log(msg, arguments[arguments.length - 1]); |
| 54 |
} |
| 55 |
} catch (e){ |
| 56 |
} |
| 57 |
|
| 58 |
} |
| 59 |
}; |
| 60 |
} |
| 61 |
} |
| 62 |
}); |
| 63 |
}); |