diff --git a/utils/controllers.js b/utils/controllers.js index 22c0bb7..1e3502a 100644 --- a/utils/controllers.js +++ b/utils/controllers.js @@ -40,7 +40,10 @@ module.exports = function(app, controllersDir = __dirname + '/../controllers') { let path = obj[url.view](req, res, function(template) { let templatePath = controllersDir + '/' + name + '/templates/' + template; + + let renderTime = Date.now(); res.render(templatePath, res.locals, function(err, out) { + log.debug('Template time: ' + (Date.now() - renderTime) + 'ms'); if (err !== null) { log.pugerror(err); } diff --git a/utils/log.js b/utils/log.js index c77670f..f1ffdcb 100644 --- a/utils/log.js +++ b/utils/log.js @@ -1,5 +1,6 @@ -var express = require('express'); -var http = require('http'); +const express = require('express'); +const http = require('http'); +const config = require('settings/config'); var log = {}; @@ -92,8 +93,12 @@ log.mailerror = function(error) { log.write('[MLE] ' + new Date() + ' ' + error, log.Color.RED); } -log.debug = function(info) { - log.write('[DBG] ' + (info !== undefined ? info : ''), log.Color.YELLOW); +if (config.DEBUG === true) { + log.debug = function(info) { + log.write('[DBG] ' + (info !== undefined ? info : ''), log.Color.YELLOW); + } +} else { + log.debug = function() {}; } log.pugerror = function(error) {