mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-24 23:55:46 -05:00
hide authorization header in logs
This commit is contained in:
parent
fcebeea3ee
commit
1a58a0f8d8
4 changed files with 8 additions and 4 deletions
|
@ -91,6 +91,8 @@ function afterConfigLoad() {
|
|||
if (!config.user_agent) config.user_agent = 'Sinopia/'+pkg.version;
|
||||
if (!config.self_path) config.self_path = config_path;
|
||||
|
||||
logger.setup(config.logs)
|
||||
|
||||
var hostport = get_hostport();
|
||||
server(config).listen(hostport[1], hostport[0]);
|
||||
logger.logger.warn({addr: 'http://'+hostport[0]+':'+hostport[1]+'/'}, 'Server is listening on @{addr}');
|
||||
|
|
|
@ -51,6 +51,6 @@ packages:
|
|||
#
|
||||
# parameters for stdout and stderr: format: json | pretty
|
||||
# {type: 'stdout', format: 'pretty', level: 'debug'},
|
||||
log:
|
||||
logs:
|
||||
- {type: stdout, format: pretty, level: http}
|
||||
#- {type: file, path: sinopia.log, level: info}
|
||||
|
|
|
@ -38,7 +38,6 @@ module.exports.setup = function(logs) {
|
|||
}
|
||||
} else {
|
||||
stream.write = function(obj) {
|
||||
obj = log_filter(obj);
|
||||
dest.write(JSON.stringify(obj, Logger.safeCycles()) + "\n");
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +47,6 @@ module.exports.setup = function(logs) {
|
|||
Logger.emit('error', err);
|
||||
});
|
||||
stream.write = function(obj) {
|
||||
obj = log_filter(obj);
|
||||
dest.write(JSON.stringify(obj, Logger.safeCycles()) + "\n");
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -89,7 +89,11 @@ function md5sum(data) {
|
|||
module.exports.log_and_etagify = function(req, res, next) {
|
||||
// logger
|
||||
req.log = Logger.logger.child({sub: 'in'});
|
||||
req.log.info({req: req, ip: req.ip}, '@{ip} requested \'@{req.method} @{req.url}\'');
|
||||
|
||||
var _auth = req.headers.authorization
|
||||
if (_auth) req.headers.authorization = '<Classified>'
|
||||
req.log.info({req: req, ip: req.ip}, '@{ip} requested \'@{req.method} @{req.url}\'')
|
||||
if (_auth) req.headers.authorization = _auth
|
||||
|
||||
var bytesin = 0;
|
||||
req.on('data', function(chunk){ bytesin += chunk.length });
|
||||
|
|
Loading…
Add table
Reference in a new issue