Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielbayley/console-debug
A better console.debug.
https://github.com/danielbayley/console-debug
console console-debugger console-log console-tool debug debugger debugging dev development env environment node node-js nodejs npm npm-module npm-package npmjs testing
Last synced: 4 days ago
JSON representation
A better console.debug.
- Host: GitHub
- URL: https://github.com/danielbayley/console-debug
- Owner: danielbayley
- License: mit
- Created: 2023-01-01T19:32:47.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-09-29T20:57:14.000Z (about 1 year ago)
- Last Synced: 2024-04-18T09:41:18.954Z (8 months ago)
- Topics: console, console-debugger, console-log, console-tool, debug, debugger, debugging, dev, development, env, environment, node, node-js, nodejs, npm, npm-module, npm-package, npmjs, testing
- Language: JavaScript
- Homepage: https://developer.mozilla.org/docs/Web/API/console/debug
- Size: 10.7 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[`console`]`.debug`
===================
A better `console`[`.debug`]. Only logs if:* A `DEBUG` [environment variable] is set
* [`NODE_ENV`] is set to `development`
* `--debug` or [`--inspect`] is passed on the command line, including from within [`npm`][][`_lifecycle_`][][`script`s]
* Running in a GitHub [Actions] environment with [`ACTIONS_STEP_DEBUG`] enabledAlso `export`s the `debug` conditional with these checks.
## Install
~~~ sh
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:
~~~ json5
// package.json
"type": "module",
"engines": {
"node": ">=14.16"
},
~~~
~~~ js
//const { console, debug } = require("@danielbayley/console-debug")
import { console, debug } from "@danielbayley/console-debug"
~~~License
-------
[MIT] © [Daniel Bayley][MIT]: LICENSE.md
[Daniel Bayley]: https://github.com/danielbayley[`console`]: https://developer.mozilla.org/docs/Web/API/console
[`.debug`]: https://developer.mozilla.org/docs/Web/API/console/debug[environment variable]: https://wikipedia.org/wiki/Environment_variable
[`NODE_ENV`]: https://nodejs.dev/en/learn/nodejs-the-difference-between-development-and-production
[`--inspect`]: https://nodejs.org/en/docs/guides/debugging-getting-started#enable-inspector[`npm`]: https://npmjs.com
[`_lifecycle_`]: https://docs.npmjs.com/cli/v9/using-npm/scripts#current-lifecycle-event
[`script`s]: https://docs.npmjs.com/cli/v9/using-npm/scripts[actions]: https://github.com/features/actions
[`ACTIONS_STEP_DEBUG`]: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging[node]: https://nodejs.org
[requires]: https://docs.npmjs.com/cli/v9/configuring-npm/package-json#engines
[`>=`]: https://docs.npmjs.com/cli/v6/using-npm/semver#ranges
[`14.16`]: https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V14.md#14.16.0
[ESM]: https://developer.mozilla.org/docs/Web/JavaScript/Guide/Modules
[only]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[`import`]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/import
[`require`]: https://nodejs.org/api/modules.html#requireid