Home

Awesome

Studio Log X

❎ X-out confidential data in log entries of a Studio Log stream.

Usage

const logger = require('@studio/log').out(process.stdout);
const logX = require('@studio/log-x');

const log = logger('app');
log.filter(logX('connection.password'));

log.input('db', { connection: { login: 'admin', password: 'secret' } });

The above produces this log output:

{"ts":1486630378584,"ns":"app","topic":"input","msg":"db","data":{
  "connection":{"login":"admin","password":"·····"}}}

Data objects are copied before modification to make it safe to pass object references as log data.

Install

❯ npm i @studio/log-x

API

// x(map)
logX({
  input: ['connection.user', 'connection.password'],
  '*': ['token']
});

// x.ns(ns, path...)
logX.ns('Login', 'request.user', 'request.password');

Supported notations

Related modules

License

MIT

<div align="center">Made with ❤️ on 🌍</div>