logasm

2.0.0 • Public • Published

Logasm

Installation

  npm install --save logasm

Preprocessors

Preprocessors allow modification of log messages, prior to sending of the message to the configured logger(s).

Whitelist

Masks all the fields except those whitelisted in the configuration using JSON Pointer. Only simple values(string, number, boolean) can be whitelisted. Whitelisting array and hash elements can be done using wildcard symbol ~.

Configuration

preprocessors:
  whitelist:
    pointers: ['/info/phone', '/addresses/~/host']

Usage

logger = Logasm.build(application_name, logger_config, preprocessors)
 
input = {password: 'password', info: {phone: '+12055555555'}, addresses: [{host: 'example.com', path: 'info'}]}
 
logger.debug("Received request", input)

Logger output:

Received request {"password": "********", "info":{"phone":"+12055555555"}, "addresses": [{"host": "example.com","path": "****"}]}

Readme

Keywords

Package Sidebar

Install

npm i logasm

Weekly Downloads

9

Version

2.0.0

License

Apache-2.0

Unpacked Size

27.9 kB

Total Files

17

Last publish

Collaborators

  • indrek