https://github.com/rqbazan/create-debug
A wrapper over debug library to display the module path as the tag
https://github.com/rqbazan/create-debug
Last synced: 6 months ago
JSON representation
A wrapper over debug library to display the module path as the tag
- Host: GitHub
- URL: https://github.com/rqbazan/create-debug
- Owner: rqbazan
- Created: 2020-04-07T23:18:31.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-26T14:41:24.000Z (over 3 years ago)
- Last Synced: 2025-03-28T21:39:25.165Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 566 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
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.
```js
// src/debug.js
import { createDebug as _createDebug } from 'create-debug'const configuration = {
rootDir: 'dist',
prefix: 'myapp',
}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 world')
```3. You will see the log in your terminal:
```sh
myapp:some:path:foo hello world
```