Render time

This commit is contained in:
Thomas Forgione 2017-09-30 11:54:49 +02:00
parent a6753d9f44
commit 9dca421dc7
No known key found for this signature in database
GPG Key ID: 3B8FC64F5BBFE109
2 changed files with 12 additions and 4 deletions

View File

@ -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);
}

View File

@ -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) {