Skip to content

Commit

Permalink
Merge pull request #463 from prashn64/perf-logging
Browse files Browse the repository at this point in the history
Rendering performance improvements by simplifying logging
  • Loading branch information
kate2753 committed May 8, 2014
2 parents 85d78c5 + 61a8477 commit a56ea05
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
9 changes: 1 addition & 8 deletions lib/dust.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,8 @@
* @public
*/
dust.log = function(message, type) {
if(dust.isDebug && dust.debugLevel === NONE) {
logger.log('[!!!DEPRECATION WARNING!!!]: dust.isDebug is deprecated. Set dust.debugLevel instead to the level of logging you want ["debug","info","warn","error","none"]');
dust.debugLevel = INFO;
}

type = type || INFO;
if (dust.indexInArray(loggingLevels, type) >= dust.indexInArray(loggingLevels, dust.debugLevel)) {
if (dust.debugLevel !== NONE && dust.indexInArray(loggingLevels, type) >= dust.indexInArray(loggingLevels, dust.debugLevel)) {
if(!dust.logQueue) {
dust.logQueue = [];
}
Expand Down Expand Up @@ -232,7 +227,6 @@
var name = filters[i];
if (name === 's') {
auto = null;
dust.log('Using unescape filter on [' + string + ']', DEBUG);
}
else if (typeof dust.filters[name] === 'function') {
string = dust.filters[name](string);
Expand Down Expand Up @@ -326,7 +320,6 @@
var ctx = this.stack,
i = 1,
value, first, len, ctxThis;
dust.log('Searching for reference [{' + down.join('.') + '}] in template [' + this.getTemplateName() + ']', DEBUG);
first = down[0];
len = down.length;

Expand Down
21 changes: 0 additions & 21 deletions test/jasmine-test/spec/coreTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1800,27 +1800,6 @@ var coreTests = [
log: "Invalid filter [nullcheck]",
message: "should fail hard for invalid filter"
},
{
name: "Using unescape filter",
source:"{test|s}",
context: {"test": "example text"},
log: "Using unescape filter on [example text]",
message: "test the log messages for an unescape filter."
},
{
name: "Reference lookup",
source:"{test}",
context: {"test": "example text"},
log: "Searching for reference [{test}] in template [Reference lookup]",
message: "test the log messages for a reference lookup."
},
{
name: "Reference lookup with dots",
source:"{test.anotherTest}",
context: {"test": "example text"},
log: "Searching for reference [{test.anotherTest}] in template [Reference lookup with dots]",
message: "test the log messages for a reference lookup."
},
{
name: "Reference not found",
source:"{wrongTest}",
Expand Down

0 comments on commit a56ea05

Please sign in to comment.