node-webshot icon indicating copy to clipboard operation
node-webshot copied to clipboard

Console running multiple times

Open cookie-ag opened this issue 9 years ago • 0 comments

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

screen shot 2016-08-28 at 6 49 53 pm

cookie-ag avatar Aug 28 '16 10:08 cookie-ag