console
.debug
A better console
.debug
. Only logs if:
- A
DEBUG
environment variable is set NODE_ENV
is set todevelopment
--debug
or--inspect
is passed on the command line, including from withinnpm
_lifecycle_
script
s- Running in a GitHub Actions environment with
ACTIONS_STEP_DEBUG
enabled
Also export
s the debug
conditional with these checks.
pnpm add @danielbayley/console-debug --save-dev
This package is ESM only, and so requires Node >=
14.16
and must be import
ed instead of require
d:
// package.json
"type": "module",
"engines": {
"node": ">=14.16"
},
//const { console, debug } = require("@danielbayley/console-debug")
import { console, debug } from "@danielbayley/console-debug"