New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

debug-symbols

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debug-symbols

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

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

Motivation

I built this small module because I wanted to use the popular debug module but extend it to:

  • Handle different log levels out of the box
  • Use colorization for different log levels (using chalk )
  • Add the amazing log-symbols symbols to logs.

Usage

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

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:

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.

Keywords

FAQs

Package last updated on 11 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc