1.0.0 • Published 3 years ago
shkmr-debugger v1.0.0
@shkmr/debugger
Simple Node.JS library for providing debugging functions
Installation
$ npm install @shkmr/debugger
or
$ yarn add @shkmr/debugger
Usage
Example main.js:
const { debug } = require('@shkmr/debugger')
debug("debugger:listen", "listen to you", "green")
setTimeout(() => {
debug("debugger:blue", "blue example", "blue")
debug("debugger:magenta", "magenta example", "magenta")
debug("debugger:yellow", "yellow example", "yellow")
debug("debugger:bye", "bye", "red")
}, 5000)
Example main.ts:
import { debug } from '@shkmr/debugger'
debug("debugger:listen", "listen to you", "green")
setTimeout(() => {
debug("debugger:blue", "blue example", "blue")
debug("debugger:magenta", "magenta example", "magenta")
debug("debugger:yellow", "yellow example", "yellow")
debug("debugger:bye", "bye", "red")
}, 5000)
The DEBUG
Environment is used to specify debugging modes (asterisk symbol is used for all modes, for example: debugger:* / *
Linux / BSD / OS X command shell
Bash / ZSH
On Linux the environment variable is set before the text, for example:
DEBUG=debugger:* node main.js
Windows Command Prompt
CMD
On Windows the environment variable is set using the set
command
set DEBUG=...
Example:
set DEBUG=debugger:* && node main.js
PowerShell
PowerShell uses different syntax to set environment variables
$env:DEBUG = "..."
Example:
$env:DEBUG="debugger:*"; node main.js
Then, run the program to be debugged as usual
Colors
At the moment there are 5 colors available, namely: red, green, blue, yellow, magenta
1.0.0
3 years ago