Render time
This commit is contained in:
parent
a6753d9f44
commit
9dca421dc7
|
@ -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);
|
||||
}
|
||||
|
|
13
utils/log.js
13
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) {
|
||||
|
|
Loading…
Reference in New Issue