@integromat/debug

A simple wrapper around debug module that adds Overseer integration.

Usage no npm install needed!

<script type="module">
  import integromatDebug from 'https://cdn.skypack.dev/@integromat/debug';
</script>

README

Debug

A simple wrapper around debug module that adds Overseer integration.

Example usage

const debug = require('@integromat/debug');

const appLogger = debug('imt:app');
const appRequestLogger = debug('imt:app:request'); // either create entirely new function
const appResponseLogger = appLogger.extend('response'); // or extend existing one

appLogger('abc');         // ... imt:app abc
appRequestLogger('def');  // ... imt:app:request def
appResponseLogger('ghj'); // ... imt:app:response ghj

const obj = {};
appLogger('Object: %O', obj); // supports logging of objects
appLogger(`Object: ${JSON.stringify(obj, null, 2)}`); // but preferred way for deeply nested objects is template literal and JSON.stringify

appLogger(() => `Object: ${JSON.stringify(obj, null, 2)}`); // for computationally intense operations use lambda functions
appLogger(() => ['Object: %O', obj]); // if there are multiple arguments, it's okay to return array