# debug-symbols

> Combines the popular debug module and log-symbols to create colorized debug logs with matching symbols

Latest version **1.0.2** (published 2022-10-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install debug-symbols
pnpm add debug-symbols
yarn add debug-symbols
bun add debug-symbols
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-10-11 |
| First published | 2022-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | nguru |
| Keywords | log, debug, levels, error, warn, success, fail, symbols |

## Links

- npm: https://www.npmjs.com/package/debug-symbols
- Repository: https://github.com/mugendi/debug-symbols
- Homepage: https://github.com/mugendi/debug-symbols#readme
- Issues: https://github.com/mugendi/debug-symbols/issues
- npm.io page: https://npm.io/package/debug-symbols

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [debug](https://npm.io/package/debug.md) ^4.3.3
- [log-symbols](https://npm.io/package/log-symbols.md) ^4.1.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2022-10-11
- 1.0.1 — 2022-01-05
- 1.0.0 — 2022-01-05

## README

# Motivation

I built this small module because I wanted to use the popular [debug](https://www.npmjs.com/package/debug) module but extend it to:

- Handle different log levels out of the box
- Use colorization for different log levels (using [chalk](https://www.npmjs.com/package/chalk) )
- Add the amazing [log-symbols](https://www.npmjs.com/package/log-symbols) symbols to logs.

# Usage

This module merely extends Debug's usage and leaves all else intact.

```javascript
const logger = require("debug-symbols")("namespace");

// Extend logger, Internally does debug.extend()
logger.extend("extend-to");

// This runs debug() as you might expect
logger.log("Default usage");

// Adding various log levels...
logger.debug("debug");
logger.info("info");
logger.warn("warn");
logger.error("error");
logger.fatal("fatal");
logger.fail("failed");
logger.success("success");
```

This will log something like this:

![](https://repository-images.githubusercontent.com/444926760/eed1683c-11fd-4eef-b88d-e71179d6ac63)

# Default Namespaces

When working with a large project, you might want to have a default **main namespace**.

For example.

> For Example:
>
> Assume my project is called `aws-server`
> I would want all scripts using `debug-symbols` to have their namespace as `aws-server:script-name`

The default namespace in this case is `aws-server`. Instead of repeating it in every script, I can set it globally using the environment variable `DEBUG_NS` and each module will adopt it.

In this case:
- The namespace `express` becomes `aws-server:express`.
- The namespace `aws-server:admin-route` remains `aws-server:admin-route`.

So to show my logs, all I need is add `process.env.DEBUG="aws-server*` and all my scripts will log as expected.

---
_Source: https://npm.io/package/debug-symbols · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
