0.1.1 • Published 4 years ago

create-winston-debug v0.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

CREATE WINSTON DEBUG

Create a debug function similar to the debug package, but using the Winston Console Transport

Installation

yarn add create-winston-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-winston-debug'

const configuration = {
  prefix: 'myapp',
  rootDir: 'dist', // I assuming that you're using Babel
  debug: 'myapp:*', // default is process.env.DEBUG
}

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 There')
  1. You will see the log in your terminal:
[myapp:some:path:foo] 2020-04-27T21:20:48.571+00:00: Hello There +0ms
0.1.1

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago