node-webshot
node-webshot copied to clipboard
Console running multiple times
Here is my code
var webshot = require('webshot');
var fs = require('fs');
var domain = require('../config').domain;
exports.error404 = function(req, res, next) {
var err = new Error('Not found');
err.status = 404;
if (!req.user) {
webshot(domain + req.path,RID + '_Error.png',function(err) {
if(err){
console.log(err);
}
});
req.flash('ErrorMSG', '' + req.path + ' is not allowed, redirecting to Login.');
console.log("Logging HTTP Error : " + err.status + " - " + err.message + " - " + req.path + " - From " + req.connection.remoteAddress + " - Using " + req.headers['user-agent'] + " - By Unauthenticated" + " - Request ID : " + RID);
}
if (req.user) {
req.flash('ErrorMSGLoggedin', '' + req.path + ' is not allowed, redirecting to tasks.');
console.log("Logging HTTP Error : " + err.status + " - " + err.message + " - " + req.path + " - From " + req.connection.remoteAddress + " - Using " + req.headers['user-agent'] + " - By " + req.session.email + " - Request ID : " + RID);
}
res.redirect('/login');
};
Whenever i GET an undefined path the same goes into loop filling my console screen with multiple queries. It was all ok before. Any ideas?
- terminal output
