Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

create-debug

rqbazan7MIT0.3.0TypeScript support: included

A wrapper over debug library to display the module path as the tag.

readme

CREATE DEBUG

A wrapper over debug library to display the module path as the tag.

Installation

yarn add create-debug

Usage

  1. Create a dedicated module to avoid pass your specific configuration to the library.
// src/debug.js
import { createDebug as _createDebug } from 'create-debug'

const configuration = {
  rootDir: 'dist',
  prefix: 'myapp',
}

export function createDebug(module) {
  return _createDebug(module, configuration)
}
  1. Use the above module in your base code such as here:
// src/some/path/foo.js
import { createDebug } from '~/debug'

const debug = createDebug(module)

debug('hello world')
  1. You will see the log in your terminal:
myapp:some:path:foo hello world