https://github.com/rqbazan/create-winston-debug
Create a debug function similar to the debug package, but using the Winston Console Transport
https://github.com/rqbazan/create-winston-debug
Last synced: 6 months ago
JSON representation
Create a debug function similar to the debug package, but using the Winston Console Transport
- Host: GitHub
- URL: https://github.com/rqbazan/create-winston-debug
- Owner: rqbazan
- Created: 2020-04-27T21:26:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-26T14:43:39.000Z (over 3 years ago)
- Last Synced: 2025-03-07T02:49:16.997Z (7 months ago)
- Language: JavaScript
- Size: 599 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# CREATE WINSTON DEBUG
Create a debug function similar to the [`debug`](https://www.npmjs.com/package/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.
```js
// 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)
}
```2. Use the above module in your base code such as here:
```js
// src/some/path/foo.js
import { createDebug } from '~/debug'const debug = createDebug(module)
debug('Hello There')
```3. You will see the log in your terminal:
```sh
[myapp:some:path:foo] 2020-04-27T21:20:48.571+00:00: Hello There +0ms
```