javascript - Rendering regex data to Jade -



javascript - Rendering regex data to Jade -

so in code below, write info extracted regex matches onto console. however, need render info jade file user, uploads log file, can view matches himself. ideas or sites information?

while ((match = rediabtoa.exec(newarray[j])) != null) { if (match.index === rediabtoa.lastindex) { rediabtoa.lastindex++; } if (match[2] === "error") { console.log(match[2]); console.log("time " + match[1]); console.log("thread name: " + match[3]); console.log("source name & line number: " + match[4]); console.log("log message: " + match[5] + '\n'); console.log("-----------------------------------------------------------------" + "\n"); var logs = [new log(match[1], match[3], match[4], match[5])] } }

update: have tried far.

jade file:

... form(method="post", action="/upload", enctype="multipart/form-data") input(type="file", name="logname") button(type="submit") upload h1. log list #logs log in logs include log

with code in index.js file

/* home page. */ router.get('/', function (req, res) { res.render('fileupload', { title: 'building log file viewer' }, {logs: logs}); }); function log(time, thread, source, mess) { this.time = time; this.thread = thread; this.source = source; this.mess = mess; }

but renders error logs undefined. i'm supposing since not set matches log entries.

res.render('fileupload', { title: 'building log file viewer' }, {logs: logs});

should be

res.render('fileupload', { title: 'building log file viewer', logs: logs });

i think logs array within jade template, don't think include log going treat log variable, it's going seek include file called "log.jade". you'll need read log files in javascript code info need strings , pass jade inclusion in html.

javascript regex node.js jade

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -