add default web log
This commit is contained in:
parent
a0e1efca1b
commit
30b9ccd00e
1 changed files with 19 additions and 1 deletions
|
|
@ -348,6 +348,22 @@ function setup(req, res, next) {
|
||||||
rec.last.push(time);
|
rec.last.push(time);
|
||||||
rec.hits++;
|
rec.hits++;
|
||||||
|
|
||||||
|
// log request
|
||||||
|
logger.emit([
|
||||||
|
req.method,
|
||||||
|
req.headers['host'],
|
||||||
|
req.url,
|
||||||
|
ipaddr,
|
||||||
|
req.headers['origin'] || '',
|
||||||
|
req.headers['user-agent']
|
||||||
|
// m: req.method,
|
||||||
|
// u: req.url,
|
||||||
|
// i: ipaddr,
|
||||||
|
// h: req.headers['host'],
|
||||||
|
// o: req.headers['origin'],
|
||||||
|
// a: req.headers['user-agent']
|
||||||
|
]);
|
||||||
|
|
||||||
// update db ip record
|
// update db ip record
|
||||||
if (time - rec.saved > ipSaveDelay) db.get(dbikey)
|
if (time - rec.saved > ipSaveDelay) db.get(dbikey)
|
||||||
.then(dbrec => {
|
.then(dbrec => {
|
||||||
|
|
@ -869,7 +885,8 @@ let ver = require('../js/license.js'),
|
||||||
wss_roots = {},
|
wss_roots = {},
|
||||||
loads = [],
|
loads = [],
|
||||||
exits = [],
|
exits = [],
|
||||||
mods = {}
|
mods = {},
|
||||||
|
logger = open_logger({dir: ".log-main"})
|
||||||
;
|
;
|
||||||
|
|
||||||
/* *********************************************
|
/* *********************************************
|
||||||
|
|
@ -1275,6 +1292,7 @@ handler.use(fullpath({
|
||||||
|
|
||||||
helper.log("------------------------------------------");
|
helper.log("------------------------------------------");
|
||||||
helper.log({port, debug, nolocal, version: ver.VERSION});
|
helper.log({port, debug, nolocal, version: ver.VERSION});
|
||||||
|
logger.emit({port, debug, nolocal, version: ver.VERSION});
|
||||||
|
|
||||||
process.on('beforeExit', processExit);
|
process.on('beforeExit', processExit);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue