@capnajax/debug

1.0.1 • Public • Published

Cap'n Ajax Debug

Extension and of Vision Media's debug module for extra highlighting and redacting sensitive information.

Installation

$ npm install @capnajax/debug

Usage

All features of the original Vision Media debug module remain available.

Extra Highlighting

For additional colour highlighting of method names and end points, put the names in square brackets. For this to work, DEBUG_COLORS must be set.

debug('[myFunction] called with params', arguments);
// highlights [myFunction] in blue

debug('[GET /my/endpoint] called');
// highlights [GET /my/endpoint] in green

Sensitive information

For logs that may contain sensitive information, there's a debug.sensitive method that will only print if the DEBUG_SENSITIVE environment variable is set.

debug('[myFunction] called with params', arguments);
// if debug is enabled, prints the log message

debug.sensitive('[myFunction] called with params', arguments);
// if debug is enable AND DEBUG_SENSITIVE is set, prints the log message.

Readme

Keywords

none

Package Sidebar

Install

npm i @capnajax/debug

Weekly Downloads

10

Version

1.0.1

License

ISC

Unpacked Size

3.83 kB

Total Files

5

Last publish

Collaborators

  • capnajax